Skip to content

Commit

Permalink
echarts add watch sidebar resize
Browse files Browse the repository at this point in the history
  • Loading branch information
PanJiaChen committed Jul 10, 2017
1 parent 8460069 commit 4ad9040
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/views/dashboard/editor/lineChart.vue
Expand Up @@ -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) {
Expand All @@ -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() {
Expand Down

0 comments on commit 4ad9040

Please sign in to comment.