fix: make watch source correct

This commit is contained in:
Justineo
2021-02-20 15:21:53 +08:00
parent f450118a3b
commit fccd92b36d

View File

@ -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;
}
}
);