0👍
I would store results
as a dictionary, instead of an array:
var results_to_dict = function (results) {
var dict = {};
results.forEach(r => dict[r.question_id] = r);
return dict;
};
results = results_to_dict(results);
Now, you can show your questions in your template with their answers:
<div v-for="question in section.questions" :key="question.question_id">
<p>Question: {{question.question_name}}</p>
<p>Answer: {{answers[question_id].text}}</p>
</div>
- [Vuejs]-Why my Front-End requests are all sended to Back-End project?
- [Vuejs]-Is it possible with Vue.js to create a computed property whose value can be changed directly?
Source:stackexchange.com