[Vuejs]-Selection on an object in Vue

0👍

You can use the return-object prop which will return the entire object of the selected item on selection.
So, add this in v-select tag:

<v-select 
    v-model="selectedRecipe" 
    :items="recipe" 
    item-text="name" 
    item-value="duration" 
    label="Select" 
    return-object>

And to print the values, you can do something like this:

<p class="answer">Recipe applied to the group : {{selectedRecipe.name}}</p>
<p class="subtitle">Duration: {{selectedRecipe.duration}}</p>

Here is the jsFiddle for demo.

Leave a comment