fix: autocomplete can not reset to undefined

pull/4640/head
undefined 3 years ago
parent a4d907a1bf
commit 741718a0f9

@ -401,13 +401,18 @@ export default function generateSelector<
// ============================== Ref =============================== // ============================== Ref ===============================
const selectorDomRef = createRef(); 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( watch(
() => props.value, () => props.value,
() => { () => {
mergedValue.value = props.value !== undefined ? props.value : props.defaultValue; mergedValue.value = props.value;
innerSearchValue.value = '';
}, },
{ immediate: true },
); );
// ============================= Value ============================== // ============================= Value ==============================
@ -429,10 +434,6 @@ export default function generateSelector<
const setActiveValue = (val: string) => { const setActiveValue = (val: string) => {
activeValue.value = val; activeValue.value = val;
}; };
const innerSearchValue = ref('');
const setInnerSearchValue = (val: string) => {
innerSearchValue.value = val;
};
const mergedSearchValue = computed(() => { const mergedSearchValue = computed(() => {
let mergedSearchValue = innerSearchValue.value; let mergedSearchValue = innerSearchValue.value;

Loading…
Cancel
Save