fix: treeSelect reset undefined not clear #4897

close #4897
This commit is contained in:
tangjinzhou 2021-11-20 15:05:20 +08:00
parent 876720f31b
commit 84b9ac5904

View File

@ -173,16 +173,15 @@ export default function generate(config: {
getEntityByValue, getEntityByValue,
}); });
const valueRef = ref<DefaultValueType>(props.defaultValue); const valueRef = ref<DefaultValueType>(
props.value === undefined ? props.defaultValue : props.value,
);
watch( watch(
() => props.value, () => props.value,
() => { () => {
if (props.value !== undefined) { valueRef.value = props.value;
valueRef.value = props.value;
}
}, },
{ immediate: true },
); );
/** Get `missingRawValues` which not exist in the tree yet */ /** Get `missingRawValues` which not exist in the tree yet */