B
B
bormor22018-08-16 18:14:12
Vue.js
bormor2, 2018-08-16 18:14:12

VueJS: using v-for on checkbox doesn't fire v-model correctly. How can this be fixed?

When you click on one checkbox, all of them are selected at once. What could be the reason? How can this be fixed?
Sandbox code:
https://codesandbox.io/s/mozwrvqz78
Component used:
https://github.com/mariomka/vue-checkbox-radio

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-08-16
@bormor2

Assign checkboxes normal values: :value="name".
Or specify an index in v-model: v-for="(name, i) in names", v-model="checkboxValue[i]".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question