vue.js v-for list not updating

Array change detection is a bit tricky in Vue. Most of the in place array methods are working as expected (i.e. doing a splice in your $data.names array would work), but assigining values directly (i.e. $data.names[0] = ‘Joe’) would not update the reactively rendered components.
Depending on how you process the server side results you might need to think about these options described in the in vue documentation: Array Change Detection.

Some ideas to explore:

  • using the v-bind:key=”some_id” to have better
  • using the push to add new elements
  • using Vue.set(example1.items, indexOfItem, newValue) (also mentioned by Artokun)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)