fixed the automatic selection in the autocomplete
This commit is contained in:
@@ -21,6 +21,10 @@ const TtSmartAutocomplete = {
|
||||
apiEndpoint: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
initialMode: {
|
||||
type: String,
|
||||
default: 'autocomplete'
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue', 'select', 'change', 'enter', 'mode-change'],
|
||||
@@ -32,7 +36,7 @@ const TtSmartAutocomplete = {
|
||||
const items = ref({});
|
||||
const highlighted = ref(-1);
|
||||
const busy = ref(false);
|
||||
const mode = ref('autocomplete');
|
||||
const mode = ref(props.initialMode || 'autocomplete');
|
||||
const logoDropdownOpen = ref(false);
|
||||
const hasMoreResults = ref(false);
|
||||
const mainInput = ref(null);
|
||||
@@ -60,6 +64,12 @@ const TtSmartAutocomplete = {
|
||||
}
|
||||
});
|
||||
|
||||
watch(() => props.initialMode, (val) => {
|
||||
if (val && val !== mode.value) {
|
||||
mode.value = val;
|
||||
}
|
||||
});
|
||||
|
||||
const debounce = (fn, ms) => {
|
||||
let timeout;
|
||||
return (...args) => {
|
||||
|
||||
Reference in New Issue
Block a user