[Vuejs]-Are there any possible ways to search multiple attribute in v-autocomplete in Vuetify?

2👍

Use custom filter function to v-autocomplete as follows

<v-autocomplete>
   ...
   :filter="customFilter"
   :item="products"
   :search-input.sync="search"
</v-autocomplete>
methods: {
     customFilter (item, queryText, itemText) {
         // return true or false according to your logic
         // i.e queryText matches with item object
     },
},

2👍

Yes, you can search multiple attribute using filter attribute which is provide in the docs:

  customSearch(item, queryText, itemText) {
      const data = item.text.toLowerCase() + item.value.toLowerCase()
      const searchText = queryText.toLowerCase()

      return textOne.indexOf(searchText) > -1 
  }

and use in the template like this:

 <v-autocomplete
     spellcheck="false" 
     :filter="customSearch"
...
</v-autocomplete>

Refer this docs: https://vuetifyjs.com/en/api/v-autocomplete/#props

Leave a comment