export default {
props: {
visible: {
type: Boolean,
default: false
},
defaultValue: {
type: Object,
default: () => ({})
}
},
watch: {
defaultValue: {
handler(newVal, oldVal) {
if(newVal) {
console.log('newVal========newVal==========newVal', newVal);
this.form = newVal;
this.form.sorce = newVal.score;
this.form.policeNo = newVal.id;
}
},
deep:true, // 深度监听
immediate:true, // 初始化监听
}
}
}
参考: https://www.cnblogs.com/xihailong/p/16185069.html