You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
newVue({el: document.getElementById("somediv"),data: function(){return{pos: {x: 10,y: 11}}},ready: function(){this.$watch('pos',function(val){// gets called in 0.10.6 val = {x:5,y:11} (if data is a object not a function)// BUT does not get called in 0.11console.log(val);})this.$watch('pos.x',function(val){// gets called val = 5console.log(val);})this.$watch('pos.x+pos.y',function(val){// gets called val = 16 (unusable value)console.log(val);})this.$data.pos.x=5;}});
The text was updated successfully, but these errors were encountered:
Yup, due to some internal changes, $watch now by default is a shallow watch. I just made some updates so you can do vm.$watch(exp, cb, true) to force a deep watch.
Thanks :D
0.11's API is still (slightly) in flux before the release. I feel deep watching is a more frequent use case than immediate callback invocation, so the third argument is now deep watching and the fourth is immediate callback.
A simple example to illustrate my issue:
The text was updated successfully, but these errors were encountered: