dimanche 6 décembre 2020

Vue auto select checkbox according to another array

So i have 2 different api request in my vue application. One of them is bringing the all questions.

[ { "id": 20, "question": "Cigarette" }, { "id": 2, "question": "Alcohol" }, { "id": 3, "question": "Diabetes" }]

In second request is returning what client has checked from the form about these questions.

{ "cigarette": "yes", "alcohol": "yes", "mobile": "+44111111111"}

and so on...

In my form.js file i want to see the checkbox has checked if client has selected that checkbox. In for loop i have this

<li v-for="(ask, askey) in patientQuestions" :key="askey">
    <b-form-checkbox v-model="ask.value"></b-form-checkbox>
</li>

How can i auto select this checkboxes. Thanks in advance




Aucun commentaire:

Enregistrer un commentaire