fix: 当前置任务被删除时进行校验

This commit is contained in:
xiaojunnuo
2025-01-24 16:35:40 +08:00
parent 398323533a
commit c89686a2fd
2 changed files with 92 additions and 5 deletions
@@ -44,8 +44,15 @@ export default {
options.value = options.value.filter((item: any) => props.from.includes(item.type));
}
}
if (props.modelValue == null && options.value.length > 0) {
ctx.emit("update:modelValue", options.value[0].value);
if (props.modelValue != null) {
const found = options.value.find((item: any) => item.value === props.modelValue);
if (!found) {
ctx.emit("update:modelValue", undefined);
}
} else {
const value = options.value.length > 0 ? options.value[0].value : undefined;
ctx.emit("update:modelValue", value);
}
}
onMounted(() => {