Skip to content

Commit

Permalink
fix[Dashboard]: fixed debounce bug (#2586) (#2597)
Browse files Browse the repository at this point in the history
  • Loading branch information
coin-monster committed Sep 26, 2019
1 parent 3396220 commit 2610271
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/views/dashboard/admin/components/mixins/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
Expand All @@ -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)
},
Expand Down

0 comments on commit 2610271

Please sign in to comment.