From 74094579fbda257685a5554c8e1373b17ab69f65 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Tue, 2 Jan 2024 15:58:40 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E8=A7=86=E5=9B=BE):=20=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E9=87=8D=E7=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/ChartComponent.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/frontend/src/views/chart/components/ChartComponent.vue b/core/frontend/src/views/chart/components/ChartComponent.vue index 998a588792..01263b93e3 100644 --- a/core/frontend/src/views/chart/components/ChartComponent.vue +++ b/core/frontend/src/views/chart/components/ChartComponent.vue @@ -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() {