У меня есть тип ввода текст в моем приложении vue js.
это мой код:
<input type="text" v-model="answer[index]" >
обновленный код:
<table>
<tr v-for="(question_overall, index) in questions">
<td>
{{ question_overall.question }}
<div>
<input type="text" :value="{id: question_overall.id , answer: ??}" v-model="answer[index]" >
</div>
{{ answer[index] }}
</td>
</tr>
</table>
data: function () {
return {
questions: [],
answer:{
id: null,
answer: null,
},
}
},
и я хочу, чтобы я повторил v-модель следующим образом:
{{ answer[index] }}
будет вывод:
{ "id": 1, "answer": "the value of this answer is from what I type in" }
Можете ли вы помочь мне в моей проблеме?спасибо.