Home > Software design >  It's possible to use an array of property on "item-text" in Vuetify?
It's possible to use an array of property on "item-text" in Vuetify?

Time:02-12

 <v-autocomplete
   v-model="friends"
   :disabled="isUpdating"
   :items="people"
   label="Select"
   item-text="name" <!-- use here Array ['name', 'id', 'value'] -->
   item-value="name"
  >

It's possible to use an array of property on "text-item" in Vuetify?

CodePudding user response:

You can try sometime like that :

:item-text="item => `${item.name} - ${item.id} - ${item.value}`"

CodePudding user response:

As the documentation mention, yes, you can use an array too.

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

CodePudding user response:

use slots like this:

<v-autocomplete
   v-model="friends"
   :disabled="isUpdating"
   :items="people"
   label="Select"
   item-value="name"
  >
 <template v-slot:item="{ item }">
   {{item.name}}-{{item.id}}-{{item.value}}
 </template>
</v-autocomplete>
  • Related