var vm=new Vue({ el:"#app", data:{ arrays:[1,2,3,4] }, methods:{ loadpage:function(){ var self=this; self.arrays[0]=5; console.log("變化之后的數(shù)組----"); console.log(self.arrays); } }, watch:{//偵聽(tīng)屬性 arrays:{ handler:function(val,oldVal){ var self=this; console.log(val); console.log(oldVal); }, deep:true } }, created:function(){ var self=this; self.loadpage(); }});
vue.js watch怎么偵聽(tīng)數(shù)組?
Jenny_xiong
2018-04-12 16:07:30