Reputation: 994
So I have this in my template:
<v-checkbox v-for="(option,index) in options" :key="option.id" :label="option.checked.toString()" :v-model="options[index].checked"></v-checkbox>
And this in my data():
options: [
{
id: '1',
name: 'Cotton',
checked : true
},
{
id: '2',
name: 'Silk',
checked : false
}
]
However, even when the value is true, the checkbox is not checked; why??
I have this in codepen:
Upvotes: 0
Views: 1414
Reputation: 4464
Delete :
before v-model
Plus it would be cleaner to use
v-model="option.checked"
instead of v-model="options[index].checked"
then you do not need index
in v-for
Upvotes: 1