diff --git a/components/vc-select/generate.tsx b/components/vc-select/generate.tsx index e1b89e48da..d0fc54f65e 100644 --- a/components/vc-select/generate.tsx +++ b/components/vc-select/generate.tsx @@ -401,13 +401,18 @@ export default function generateSelector< // ============================== Ref =============================== const selectorDomRef = createRef(); - const mergedValue = ref(); + const innerSearchValue = ref(''); + const setInnerSearchValue = (val: string) => { + innerSearchValue.value = val; + }; + + const mergedValue = ref(props.value !== undefined ? props.value : props.defaultValue); watch( () => props.value, () => { - mergedValue.value = props.value !== undefined ? props.value : props.defaultValue; + mergedValue.value = props.value; + innerSearchValue.value = ''; }, - { immediate: true }, ); // ============================= Value ============================== @@ -429,10 +434,6 @@ export default function generateSelector< const setActiveValue = (val: string) => { activeValue.value = val; }; - const innerSearchValue = ref(''); - const setInnerSearchValue = (val: string) => { - innerSearchValue.value = val; - }; const mergedSearchValue = computed(() => { let mergedSearchValue = innerSearchValue.value;