refactor function

This commit is contained in:
Qiuxia Fan 2022-07-28 17:54:25 +08:00
parent 1f98d2bfa1
commit 7818a11aa5

View File

@ -94,21 +94,7 @@ onMounted(async () => {
}, 1000); }, 1000);
}); });
watch( function updateOptions() {
() => props.option,
(newVal, oldVal) => {
if (!available.value) {
return;
}
if (JSON.stringify(newVal) === JSON.stringify(oldVal)) {
return;
}
setOptions(newVal);
}
);
watch(
() => props.filters,
() => {
const instance = getInstance(); const instance = getInstance();
if (!instance) { if (!instance) {
return; return;
@ -163,6 +149,24 @@ watch(
seriesIndex: 0, seriesIndex: 0,
}); });
} }
}
watch(
() => props.option,
(newVal, oldVal) => {
if (!available.value) {
return;
}
if (JSON.stringify(newVal) === JSON.stringify(oldVal)) {
return;
}
setOptions(newVal);
}
);
watch(
() => props.filters,
() => {
updateOptions();
} }
); );