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', 'line-stack',
'scatter' 'scatter'
], ],
resizeTimer: null resizeTimer: null,
renderTimer: null
} }
}, },
@ -499,7 +500,11 @@ export default {
// //
const chart = this.myChart const chart = this.myChart
this.setBackGroundBorder() 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) window.removeEventListener('resize', chart.resize)
}, },
setBackGroundBorder() { setBackGroundBorder() {