From 363745aa003900903b2216136ad7e9ffa2ecd999 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Sat, 2 Apr 2022 11:33:35 +0800 Subject: [PATCH] fix graph --- src/components/Graph.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/Graph.vue b/src/components/Graph.vue index a694cdeb..c216ebee 100644 --- a/src/components/Graph.vue +++ b/src/components/Graph.vue @@ -28,6 +28,7 @@ import { computed, } from "vue"; import type { PropType } from "vue"; +import _ from "lodash"; import { useECharts } from "@/hooks/useEcharts"; import { addResizeListener, removeResizeListener } from "@/utils/event"; @@ -71,15 +72,15 @@ onMounted(async () => { }); watch( - () => props.option, - (newVal, oldVal) => { + () => _.cloneDeepWith(props.option), + (data, old) => { if (!available.value) { return; } - if (JSON.stringify(newVal) === JSON.stringify(oldVal)) { + if (data === old) { return; } - setOptions(newVal); + setOptions(data); } );