[Vuejs]-V-model on a newly created property?

0👍

Try it that way:

<div v-for="user in users">
  <input type="checkbox" v-model="user.published">
  <button @click="user.published=!user.published">Toggle</button>
</div>

In your hook:

created() {
    for (i in this.users) {
        this.users[i].published = true;
    }
}

Leave a comment