[Vuejs]-VueJS Virtual field on array item

0👍

Please read docs on vue lifecycle :

id prefer you set the list to be a computed property that always checks for returned items : ie ,

new Vue({
    el: '#app',
  data: {
    list: []
  },
  computed: {
   list (){
    // Let's imagine that this is an Ajax Call to a webservice
    let returned =  [
      {
        id: 1,
        title: 'My first Item'
      },
      {
        id: 2,
        title: 'My second Item'
      }
    ]
     return returned
   }
  }
})

Leave a comment