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
     },
   }
}
posted @ 2022-08-12 21:16  无泪的遗憾、愿我能  阅读(359)  评论(0)    收藏  举报
浏览器标题切换
浏览器标题切换end