echarts add watch sidebar resize

This commit is contained in:
Pan 2017-07-10 10:52:59 +08:00
parent 84600696e3
commit 4ad90406af
1 changed files with 10 additions and 2 deletions

View File

@ -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 @@
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() {