I have 2 arrays one for possible checkbox variants and one for already saved-checked boxes.VUEJS template for example
<ul>
<li v-for="cit in possable">
<label>
<input
type="checkbox"
:checked="savedcbx.indexOf(+cit.id)>-1"
:value="cit.id"/>
{{cit.rname}}
</label>
</li>
</ul>
And my question about how add new checkedbox to saved array or delete from saved array uncheckedbox&
savedcbx
, by using v-model whenever a checkbox is checked/unchecked thesavedcbx
will be changed. Anyway, yes, if you want to have a list of currently checked checkboxes just usev-model
. – Incomprehensive