data: {
  obj: {
       age: 18      
    }  
},
watch: {
    obj: {
         handler(newVal, oldVal){
            
        },
         deep: true
    }
}                

2. 监听对象的某个属性变化

data: {
  obj: {
    age: 18
  }
},
computed: {
  isage(){
    return this.obj.age
  }
},
watch: {
  isage(){
  console.log('obj.age发生变化')
  }
}

  

 

相关文章:

  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
相关资源
相似解决方案