开发者社区 问答 正文

watch怎么深度监听对象变化

[vue] watch怎么深度监听对象变化

展开
收起
游客7iokfgo4yexey 2020-05-23 21:12:43 1343 分享 版权
1 条回答
写回答
取消 提交回答
  • deep设置为true 就可以监听到对象的变化 let vm=new Vue({ el:"#first", data:{msg:{name:'北京'}}, watch:{ msg:{ handler (newMsg,oldMsg){ console.log(newMsg); }, immediate:true, deep:true } } }) 问题来源于GitHub,查看更多答案,请查看https://github.com/haizlin/fe-interview/issues/265

    2020-05-24 12:08:22
    赞同 展开评论
问答地址: