2016-05-05 10 views

答えて

8

は、あなたのVMの作成に時計セクションを使用します。

var vm = new Vue({ 
    el: 'body', 
    data: { 
     items: [] 
    }, 
    computed: { 
     item_length: function() { 
      return this.battle_logs.length; 
     } 
    }, 
    watch: { 
     items: { 
      handler: function() { 
       console.log('caught!'); 
      }, 
      deep: true 
     } 
    } 
}); 

または計算長さ属性を見る:

vm.$watch('item_length', function(newVal, oldVal) { 
    console.log('caught!'); 
});