[Vuejs]-How to see changes in new data generated in a vue component?

0👍

You don’t declare the show variables that your checkboxes are bound to, so they are not reactive – Vue is not aware when one is updated.

It should be initialized like so:

  items: [
    { name: 'Ryu', show: false },
    { name: 'Ken', show: false },
    { name: 'Akuma', show: false }
  ]

You might think that newData would fix it, since it assigns a show member to each item, but Vue cannot detect added properties so they’re still not reactive. If you initialized the data as I show above, then the assignment would be reactive.

If you want to add a new reactive property to an object, you should use Vue.set.

Leave a comment