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);
});
watch(
() => props.option,
(newVal, oldVal) => {
if (!available.value) {
return;
}
if (JSON.stringify(newVal) === JSON.stringify(oldVal)) {
return;
}
setOptions(newVal);
}
);
watch(
() => props.filters,
() => {
function updateOptions() {
const instance = getInstance();
if (!instance) {
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(() => {