is there a way to get the item-value by not using the v-model in v-select... Here is my code.
<v-flex xl4 lg4 md4 sm6 xs12 class="pa-2" v-for="(question, i) in questions" :key="i">
<v-select
:label="question.name"
:items="question.answers"
item-value="id"
item-text="name"
@change="addAnswer(i)"
required
></v-select>
</v-flex>
I can't used a v-model since it is a loop. I can passed the i in the loop for the question but how about the item-value?
Methods:
addAnswer(i){
this.questionAnswer.push({
questionId: i,
answerId: 'this should be answer Id'
})
console.log(this.questionAnswer)
}
If you have any idea how to do this... It would be a great help. Thanks.
The @change="addAnswer" will pass to the addAnswer method the selected value.
So you don't have to pass the index.Anyway i made an example to see my way of solution.It needs more code to be perfect,but i think it may help you.
See it in action here
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