[Vuejs]-Vue js set up v-model with dynamic property

0👍

You could create a method:

methods: {
    isSelected (key) {
        return this.selected.includes(key);
    }
}

and set v-model to v-model="isSelected(key)"

0👍

try:
<v-card v-for="(item, index) in myData">
<v-checkbox v-model="item" :name="index" ></v-checkbox>
</v-card>

What i dont get is.. Why is your myData a obj and not an array of obj? Then you could do this:

<v-card v-for="item in myData">
<v-checkbox v-model="item.checked" :name="item.name" ></v-checkbox>
</v-card>

Leave a comment