I have a list of objects:
var itens =
[ {
name: 'a',
id: 1
},
{
name: 'b',
id: 2
},{
name: 'c',
id: 3
}
]
so I show in a select:
<v-select
:items="itens"
v-model="selectedItem"
item-text="name"
label="Cartório"
single-line
></v-select>
so in my this.selectedItem
have the name but I wanna to bind the whole object {id and name}
it`s possible?
Yes it's possible.
You have to use return-object
props of v-select
Like that :
<v-select
:items="items"
v-model="selectedItem"
item-text="name"
label="Cartório"
single-line
return-object
/>
CodePen
Vuetify Doc about return-obejct in v-select
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With