Commit 4ad90406 authored by Pan's avatar Pan

echarts add watch sidebar resize

parent 84600696
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
}, 100) }, 100)
window.addEventListener('resize', this.__resizeHanlder) window.addEventListener('resize', this.__resizeHanlder)
} }
// 监听侧边栏的变化
const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
sidebarElm.addEventListener('transitionend', this.__resizeHanlder)
}, },
beforeDestroy() { beforeDestroy() {
if (!this.chart) { if (!this.chart) {
...@@ -47,8 +51,12 @@ ...@@ -47,8 +51,12 @@
if (this.autoResize) { if (this.autoResize) {
window.removeEventListener('resize', this.__resizeHanlder) window.removeEventListener('resize', this.__resizeHanlder)
} }
this.chart.dispose();
this.chart = null; const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
sidebarElm.removeEventListener('transitionend', this.__resizeHanlder)
this.chart.dispose()
this.chart = null
}, },
methods: { methods: {
initChart() { initChart() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment