From 84b9ac590452bc17f4ce0f8b944e3d17b1407298 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sat, 20 Nov 2021 15:05:20 +0800 Subject: [PATCH] fix: treeSelect reset undefined not clear #4897 close #4897 --- components/vc-tree-select/generate.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/vc-tree-select/generate.tsx b/components/vc-tree-select/generate.tsx index 9c96d84f8..228dddc0f 100644 --- a/components/vc-tree-select/generate.tsx +++ b/components/vc-tree-select/generate.tsx @@ -173,16 +173,15 @@ export default function generate(config: { getEntityByValue, }); - const valueRef = ref(props.defaultValue); + const valueRef = ref( + props.value === undefined ? props.defaultValue : props.value, + ); watch( () => 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 */