From a03d1edac689088d88f0b402ca6b1065a49ee6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Tue, 4 Sep 2018 14:40:53 +0800 Subject: [PATCH] fix[LineChart]: fixed transitionend bug (#1045) Fixed https://github.com/PanJiaChen/vue-element-admin/issues/1036 --- src/views/dashboard/admin/components/LineChart.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/views/dashboard/admin/components/LineChart.vue b/src/views/dashboard/admin/components/LineChart.vue index 390c25a4..ef493c4b 100644 --- a/src/views/dashboard/admin/components/LineChart.vue +++ b/src/views/dashboard/admin/components/LineChart.vue @@ -56,7 +56,7 @@ export default { // 监听侧边栏的变化 const sidebarElm = document.getElementsByClassName('sidebar-container')[0] - sidebarElm.addEventListener('transitionend', this.__resizeHandler) + sidebarElm.addEventListener('transitionend', this.sidebarResizeHandler) }, beforeDestroy() { if (!this.chart) { @@ -67,12 +67,17 @@ export default { } const sidebarElm = document.getElementsByClassName('sidebar-container')[0] - sidebarElm.removeEventListener('transitionend', this.__resizeHandler) + sidebarElm.removeEventListener('transitionend', this.sidebarResizeHandler) this.chart.dispose() this.chart = null }, methods: { + sidebarResizeHandler(e) { + if (e.propertyName === 'width') { + this.__resizeHandler() + } + }, setOptions({ expectedData, actualData } = {}) { this.chart.setOption({ xAxis: {