New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vue] watch怎么深度监听对象变化 #265
Labels
vue
vue
Comments
'a.b.c', 然后直接解析到c那层, 绑定observer |
|
let vm=new Vue({
el:"#first",
data:{msg:{name:'北京'}},
watch:{
msg:{
handler (newMsg,oldMsg){
console.log(newMsg);
},
immediate:true,
deep:true
}
}
}) |
选项:deep |
为什么无法监听对象的属性,因为对象保存的是地址。
如何监听对象obj的所有属性:
注意:如果直接监听到具体的某个属性值则获取到的是newValue和oldValue,如果监听属性所属的对象或者祖先对象,则返回的是对应变更后的对象。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[vue] watch怎么深度监听对象变化
The text was updated successfully, but these errors were encountered: