To fixed https://github.com/PanJiaChen/vue-element-admin/issues/2586
This commit is contained in:
parent
1602577733
commit
1a83a40106
|
@ -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…
Reference in New Issue