I have a v-autocomplete with 9000 items.
The component code looks like below:
<v-autocomplete
v-model="form.fields.city_id"
:items="cities_subregions"
item-text="name"
item-value="id"
:filter="locationsFilter"
></v-autocomplete>
In the locationsFilter function I have the below:
locationsFilter (item, queryText, itemText) {
const textOne = item.city_name.normalize('NFD').replace(/[\u0300-\u036f]/g, "").toLowerCase();
const searchText = queryText.normalize('NFD').replace(/[\u0300-\u036f]/g, "").toLowerCase();
return textOne.startsWith(searchText) || searchText.length > 2 && textOne.indexOf(searchText) > -1 && textOne.length/(3*textOne.split(' ').length) < searchText.length;
},
Even if a set a return null
to that function, when the user types it will be laggy.
Therefore, I would like the filter locationsFilter
to be called once each ~250ms.
Is there a way to achieve this?