0👍
Try to use @input
event and value
attribute instead of v-model
:
<form v-for="(questions, index) in data">
<div v-for="(question, index2) in questions">
<input type="text" @input="($event)=>onInput($event.target.value,index,index2)" :value="forms[index+'-'+index2]"/>
</div>
</form>
<script>
data: function () {
return {
forms [],
}
},
mounted () {
this.setForm();
},
methods: {
onInput(val,index,index2){
this.$set(this.forms,index+'_'+'index2',val)
},
setForm() {
for (let question = 0; question < this.questions.length; ++question) {
for (let user = 0; user < this.users.length; ++user) {
this.forms[user+'-'+question] = this.getPoints(user, question)// getPoints does return a single value
}
}
}
}
</script>
Source:stackexchange.com