I have the following v-select in my code:
<v-select
v-if='d.length'
v-model='ci'
:items='d'
item-text='value.name'
item-value='value.name'
label='label'
multiple='multiple'
height='60'
small-chips
single-line
solo
@change='itemChanged'
>
<template v-slot:prepend-item v-if='multiple && title && d.length'>
<v-list-tile
ripple
@click="action"
>
<v-list-tile-action>
<v-icon :color="ci.length > 0 ? 'indigo darken-4' : ''">{{ icon }}</v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>{{title}}</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
<v-divider class="mt-2"></v-divider>
</template>
<template v-slot:selection="{ item, index }">
<v-chip v-if="index === 0">
<span>{{ item.text }}</span>
</v-chip>
<span
v-if="index === 1"
class="grey--text caption"
>(+{{ checkedItems.length - 1 }} others)</span>
</template>
</v-select>
It receives its model, items and other defs as props. Model and Items are identical arrays of objects with the following structure:
{text: 'text', value: {name: 'foo'}}
So essentially all the items are selected when the component is mounted.
Once the user clicks on an item from the list, I want to receive in my itemChanged
method either the entire object, or at least the value object. For time being I only want to console log the received object:
itemChanged(value) {
console.log('Changed item', value);
}
But it prints the entire model array, minus the clicked item
Tried to use return-object
, tried to change the item-value and change the objects structure - always the same result.
Any ideas how can I get only the clicked item object/value?