diff --git a/packages/vuetify/src/components/VAutocomplete/VAutocomplete.tsx b/packages/vuetify/src/components/VAutocomplete/VAutocomplete.tsx index 27e5abd3db4..474501a6daa 100644 --- a/packages/vuetify/src/components/VAutocomplete/VAutocomplete.tsx +++ b/packages/vuetify/src/components/VAutocomplete/VAutocomplete.tsx @@ -120,7 +120,7 @@ export const VAutocomplete = genericComponent true, }, - setup (props, { slots }) { + setup (props, { emit, slots }) { const { t } = useLocale() const vTextFieldRef = ref() const isFocused = shallowRef(false) @@ -133,7 +133,13 @@ export const VAutocomplete = genericComponent vTextFieldRef.value?.color) const { InputIcon } = useInputIcon(props) - const search = useProxiedModel(props, 'search', '') + const _search = shallowRef(props.search ?? '') + const search = computed({ + get: () => _search.value, + set: (val: string | null) => { + _search.value = val ?? '' + }, + }) const model = useProxiedModel( props, 'modelValue', @@ -426,6 +432,16 @@ export const VAutocomplete = genericComponent { + if (!isFocused.value || isSelecting.value) return + + emit('update:search', val) + }) + + watch(() => props.search, val => { + _search.value = val ?? '' + }) + watch(search, val => { if (!isFocused.value || isSelecting.value) return