vue1.0和vue2.0的watch监听事件写法详解

如下所示:

watch: {
 aaa: {
  handler: function (newVal,oldVal) {
   console.log('当前的值:'+ newVal);
   console.log('旧的值' + oldVal);
  },
  deep: true  //深度监听
 }
}

以上这篇vue1.0和vue2.0的watch监听事件写法详解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持亿速云。