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;
@ -164,6 +150,24 @@ watch(
}); });
} }
} }
watch(
() => props.option,
(newVal, oldVal) => {
if (!available.value) {
return;
}
if (JSON.stringify(newVal) === JSON.stringify(oldVal)) {
return;
}
setOptions(newVal);
}
);
watch(
() => props.filters,
() => {
updateOptions();
}
); );
onBeforeUnmount(() => { onBeforeUnmount(() => {