Browse Source

fix: autocomplete can not reset to undefined

pull/4640/head
undefined 3 years ago
parent
commit
741718a0f9
  1. 15
      components/vc-select/generate.tsx

15
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;

Loading…
Cancel
Save