VUE WATCH monitor objects like the old and new value approach

data:{
    haoroomsObj:{
        haoroomstestinner:{
            a: '我是haorooms资源库',
            b: '我是haorooms博客'
        }
    }
},
computed: {
  newHaorooms() {
    return this.haoroomsObj
  }
watch: {
  newHaorooms: {
    handler: (val, olVal) => {
      console.log('我变化了', val, olVal)
    },
    deep: true
  }
},

Listening to attribute it.

Published 37 original articles · won praise 8 · views 6740

Guess you like

Origin blog.csdn.net/qq_22936647/article/details/103975840