vue watch 深度监听数据变化

963 阅读1分钟

当要对象的子元素是否变化时,需要使用深度监听的方法:

watch: {
    params: {
      handler(newVal, oldVal) {
        console.log('newVal:',newVal);
      },
      deep: true
    },
}