Vue Vuetify。 v-for循环内的v-checkbox的v-model取不正确的值

时间:2020-05-28 21:33:46

标签: vue.js vuetify.js v-for v-model

所以我的模板中有这个

git pull

这在我的data()中:

 <v-checkbox v-for="(option,index) in options" :key="option.id" :label="option.checked.toString()" :v-model="options[index].checked"></v-checkbox> 

但是,即使该值为true,也不会选中该复选框。为什么?

我在codepen中有这个

https://codepen.io/averied/pen/JjYQLJQ?editable=true&editors=101%3Dhttps%3A%2F%2Fvuetifyjs.com%2Fen%2Fcomponents%2Fselection-controls%2F

2 个答案:

答案 0 :(得分:2)

:之前不需要v-model

答案 1 :(得分:0)

:之前删除v-model

v-model="option.checked"

代替v-model="options[index].checked"

那么您不需要index中的v-for