Answer the question
In order to leave comments, you need to log in
How to pull the data attribute from a checkbox when it changes in Vue?
Hey! There are two cycles:
around this there is another one, but it doesn't matter...
<div v-for="(item, key2) in subitems.items" v-bind:key="key2" v-bind:class="[item == '' ? 'empty' : '']" class="seats-cell">
<input type="checkbox" v-bind:id="key + item" v-bind:value="key + item" :data-level="subitems.meta.level" :data-name="subitems.meta.name" :disabled="item == ''" v-model="checkbox">
<label class="label label-default" v-bind:for="key + item"><span>{{ item }}</span></label>
</div>
<ul>
<li v-for="(item, key) in checkbox" :key="key">Место {{ item }}</li> - тут item это тупо value чекбокса.
</ul>
Answer the question
In order to leave comments, you need to log in
Add a true-value attribute to the checked, and enter an object with the necessary data into it
and now in checked with the selected checkbox there will be an object and the fields level, name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question