watch deep

watch:{
form: {
handler(val){
if (val.userId){
this.userList.forEach(item => {
if (val.userId === item.userId){
this.form.nickName = item.nickName
}
});
}

if (val.fromId){
this.userList.forEach(item => {
if (val.fromId === item.userId){
this.form.fromNickName = item.nickName
}
});
}
},
deep: true
}
},
posted @ 2021-10-10 13:38  xiondun  阅读(31)  评论(0编辑  收藏  举报