So, I need to generate x amount of "selects" based on a result from a query to an external endpoint.
Below is an example of the json that is the data I use to generate my selects. This example contains only one "question" in an array of "questions". (Also, the array construct inside the "answers" is a little bit exaggerated but that's what I have to work with)
"questions": [{
"question": [
{
"answers": [
{
"answer": [
{
"answer": "Answer 1",
"id": 216,
"questionID": 83,
"selected": false,
"sortOrder": 1
},
{
"answer": "Answer 2",
"id": 217,
"questionID": 83,
"selected": true,
"sortOrder": 2
},
... plus x number of "answers" here..
]
}
],
"question": "Question 1",
}
]}
...]
So, I generate the selects like so (I have stripped the example from irrelevant styling):
<v-layout row wrap v-for="question in questionnaire.questions[0].question"
:key="question.id">
<span>{{question.question}}</span>
<v-select
item-text="answer"
item-value="id"
:items="question.answers[0].answer"
ref="answer_selects"
></v-select>
Now, back to my question. As you can see in the json the second "answer" has a property "selected" with the value of "true". This means that I have to set this particular item as selected "by default". How do I achieve this in a good vue manner?