THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

fix[Dashboard]: fixed debounce bug (#2586) (#2597)

To fixed https://github.com/PanJiaChen/vue-element-admin/issues/2586
refactor/copy
MaYuanhai 花裤衩 5 months ago
parent
commit
1336b92c2f
1 changed files with 7 additions and 8 deletions
  1. +7
    -8
      src/views/dashboard/admin/components/mixins/resize.js

+ 7
- 8
src/views/dashboard/admin/components/mixins/resize.js View File

@@ -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)
},


Loading…
Cancel
Save