perf(视图): 减少重绘

This commit is contained in:
wisonic-s 2024-01-02 15:58:40 +08:00
parent 0f11bea251
commit 74094579fb

View File

@ -145,7 +145,8 @@ export default {
'line-stack',
'scatter'
],
resizeTimer: null
resizeTimer: null,
renderTimer: null
}
},
@ -499,7 +500,11 @@ export default {
//
const chart = this.myChart
this.setBackGroundBorder()
setTimeout(chart.setOption(option, true), 500)
this.renderTimer && clearTimeout(this.renderTimer)
this.renderTimer = setTimeout(() => {
chart.clear()
chart.setOption(option, true)
}, 500)
window.removeEventListener('resize', chart.resize)
},
setBackGroundBorder() {