echarts add watch sidebar resize
This commit is contained in:
@@ -39,6 +39,10 @@
|
||||
}, 100)
|
||||
window.addEventListener('resize', this.__resizeHanlder)
|
||||
}
|
||||
|
||||
// 监听侧边栏的变化
|
||||
const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
|
||||
sidebarElm.addEventListener('transitionend', this.__resizeHanlder)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
@@ -47,8 +51,12 @@
|
||||
if (this.autoResize) {
|
||||
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: {
|
||||
initChart() {
|
||||
|
Reference in New Issue
Block a user