Reputation: 2328
By default it filters by any value containing the input value, regardless the position of this one.
I would like to filter by values that start with the input value.
Example:
-Values: "apple", "pplea", "eapple"
-Input: "app"
-Actual output: "apple", "pplea", "eapple"
-Expected output: "apple"
Is it possible to do this? I can't find it in the props
Upvotes: 0
Views: 1627
Reputation: 816
You can use filter
method which is provided by Vuetify,
So it can be used like this,
<v-autocomplete v-model="select" :items="items" label="Pick a fruit" :filter="getList"></v-autocomplete>
the getList method as follows,
getList (item, queryText, itemText) {
return itemText.toLocaleLowerCase().startsWith(queryText.toLocaleLowerCase())
}
https://codepen.io/anon/pen/JVQxyZ?editors=1010
Hope it helps!
Upvotes: 2