Skip to content

Commit 8acb637

Browse files
committed
fix[Dashboard]: fixed debounce bug (#2586) (#2597)
To fixed PanJiaChen/vue-element-admin#2586
1 parent 4761fcf commit 8acb637

File tree

1 file changed

+7
-8
lines changed
  • src/views/dashboard/admin/components/mixins

1 file changed

+7
-8
lines changed

src/views/dashboard/admin/components/mixins/resize.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ import { debounce } from '@/utils'
33
export default {
44
data() {
55
return {
6-
$_sidebarElm: null
6+
$_sidebarElm: null,
7+
$_resizeHandler: null
78
}
89
},
910
mounted() {
11+
this.$_resizeHandler = debounce(() => {
12+
if (this.chart) {
13+
this.chart.resize()
14+
}
15+
}, 100)
1016
this.$_initResizeEvent()
1117
this.$_initSidebarResizeEvent()
1218
},
@@ -27,13 +33,6 @@ export default {
2733
methods: {
2834
// use $_ for mixins properties
2935
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
30-
$_resizeHandler() {
31-
return debounce(() => {
32-
if (this.chart) {
33-
this.chart.resize()
34-
}
35-
}, 100)()
36-
},
3736
$_initResizeEvent() {
3837
window.addEventListener('resize', this.$_resizeHandler)
3938
},

0 commit comments

Comments
 (0)