vue2使用ts深度监听对象属性

首先引入Watch

import {
    
     Component, Vue, Prop,Watch } from 'vue-property-decorator';

代码如下

@Watch("templateEditForm.type", {
    
     immediate: true, deep: true })
 onTypeChange(newVal:any, oldVal:any) {
    
    
     console.log(newVal + ',' + oldVal);
 }

猜你喜欢

转载自blog.csdn.net/qq_37617413/article/details/121224629