From 68df4582c1edaf1952e6c21d769981e348fb3d04 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期四, 20 二月 2025 18:00:29 +0800
Subject: [PATCH] 流输出

---
 src/components/chat/chatComponents/hooks/useDrawChatChart.ts |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/src/components/chat/chatComponents/hooks/useDrawChatChart.ts b/src/components/chat/chatComponents/hooks/useDrawChatChart.ts
index 8fd59ed..2f057e5 100644
--- a/src/components/chat/chatComponents/hooks/useDrawChatChart.ts
+++ b/src/components/chat/chatComponents/hooks/useDrawChatChart.ts
@@ -16,28 +16,38 @@
 		resizeChart?.(width, height);
 	};
 
-	onMounted(() => {
+	const initChart = () => {
 		setTimeout(() => {
-			const parent = chartRef.value.parentElement;
-			const parentBound = parent.getBoundingClientRect();
-			chartInstance.value = echarts.init(chartRef.value, undefined, {
-				width: parentBound.width,
-				height: parentBound.height,
-				locale: 'ZH',
-			});
-			resizeChart = debounce((width, height) => {
-				chartInstance.value.resize({
-					width: width,
-					height: height,
+			const instance = echarts.getInstanceByDom(chartRef.value);
+			if (!instance) {
+				const parent = chartRef.value.parentElement;
+				const parentBound = parent.getBoundingClientRect();
+
+				chartInstance.value = echarts.init(chartRef.value, undefined, {
+					width: parentBound.width,
+					height: parentBound.height,
+					locale: 'ZH',
 				});
-			});
+
+				resizeChart = debounce((width, height) => {
+					chartInstance.value.resize({
+						width: width,
+						height: height,
+					});
+				});
+			}
 
 			drawChart();
 		}, 100);
+	};
+
+	onMounted(() => {
+		initChart();
 	});
 
 	return {
 		chartContainerResize,
 		chartInstance,
+		
 	};
 };

--
Gitblit v1.9.3