From fccd92b36dde2041187463f3c57606b6b511e1f5 Mon Sep 17 00:00:00 2001 From: Justineo Date: Sat, 20 Feb 2021 15:21:53 +0800 Subject: [PATCH] fix: make watch source correct --- src/ECharts.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/ECharts.ts b/src/ECharts.ts index d795168..e29a24c 100644 --- a/src/ECharts.ts +++ b/src/ECharts.ts @@ -104,15 +104,7 @@ export default defineComponent({ } } - const { - theme, - initOptions, - group, - autoresize, - manualUpdate, - loading, - loadingOptions - } = toRefs(props); + const { autoresize, manualUpdate, loading, loadingOptions } = toRefs(props); let unwatchOption: (() => void) | null = null; watch( manualUpdate, @@ -151,16 +143,22 @@ export default defineComponent({ } ); - watch([theme, initOptions], () => { - cleanup(); - init(); - }); + watch( + [() => props.theme, () => props.initOptions], + () => { + cleanup(); + init(); + }, + { + deep: true + } + ); watch( - () => group, + () => props.group, group => { - if (group && group.value && chart.value) { - chart.value.group = group.value; + if (group && chart.value) { + chart.value.group = group; } } );