From 311ace12f41f6e6b6919a6c1782ece2b3fd5a8cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E4=BA=91=E6=B5=B7?= <414199639@qq.com> Date: Mon, 23 Sep 2019 23:44:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:dashboard=E9=A1=B5=E9=9D=A2=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8resize=E7=9A=84=E9=98=B2=E6=8A=96=E5=B9=B6=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E9=98=B2=E4=BD=8F=E6=8A=96=E5=8A=A8=20(#2586)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/admin/components/mixins/resize.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/views/dashboard/admin/components/mixins/resize.js b/src/views/dashboard/admin/components/mixins/resize.js index bcd17bf0..234953b1 100644 --- a/src/views/dashboard/admin/components/mixins/resize.js +++ b/src/views/dashboard/admin/components/mixins/resize.js @@ -3,10 +3,16 @@ import { debounce } from '@/utils' export default { data() { return { - $_sidebarElm: null + $_sidebarElm: null, + $_resizeHandler: null } }, mounted() { + this.$_resizeHandler = debounce(() => { + if (this.chart) { + this.chart.resize() + } + }, 100) this.$_initResizeEvent() this.$_initSidebarResizeEvent() }, @@ -27,13 +33,6 @@ export default { methods: { // use $_ for mixins properties // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential - $_resizeHandler() { - return debounce(() => { - if (this.chart) { - this.chart.resize() - } - }, 100)() - }, $_initResizeEvent() { window.addEventListener('resize', this.$_resizeHandler) },