Creating object instances as responses can be done like this:
<el-input :id="'question_' + question.id" v-model="answers[question.id]"></el-input>
When entering data into these inputs, the output will look something like this:
Answers: object
{
"19":"Hello",
"20":"Test",
"22":"04718810200",
"26":"Belgium"
}
To display these answers to users when they revisit the page, they can be collected using an axios
call in this way:
axios.get('/bilan/' + this.$route.params.id).then(response => {
this.questions = response.data.data
this.questions.questions.forEach(question => {
if (question.answer) {
this.answers[question.id] = question.answer.answer
}
})
})
While this method successfully populates the answer objects and fills the inputs with saved answers, it lacks the desired functionality. Modifying an input does not work as expected, and nothing gets updated.
What could be causing this issue?