其他分享
首页 > 其他分享> > watch监听对象

watch监听对象

作者:互联网

watch: {
   queryData: {
     handler: function() {
      //do something
     },
     deep: true
   }
}

watch: {
   'queryData.name': {
     handler: function() {
      //do something
     },
   }
}
或
watch: {
  'queryData.name'(newValue, oldValue) {
    console.log(newValue)
    }
}

监听对象具体属性,方法二(computed+watch)
computed: {
  getName: function() {
    return this.queryData.name
  }
}
watch: {
   getName: {
     handler: function() {
      //do something
     },
   }
}

标签:function,do,name,对象,watch,queryData,handler,监听
来源: https://www.cnblogs.com/newobjs/p/16581384.html