-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Description
您好,上次拜读您代码的时候还是0.11版本,非常喜欢。最近Vue升级到了1.0X版本,于是又读了一遍
在断点的时候遇到个问题:
按照您的设计:对象和数组中____ob____的dep是用来监控数组结构的,在数组中任何改变数组结构的方法('push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse')都会调用数组的____ob____.dep.notify。按照这个逻辑在对象结构发生变化的时候是不是也会调用对象的____ob____.dep.notify; 不知道是不是我的理解有误,下面的代码没有触发watcher的update。
以下是测试代码:
var testVM = new Vue({
el:'#ct',
data: {
name: '测试人员',
info: {
age: 12,
school: '测试学校'
},
frends: [{}]
}
});
testVM.$watch('info', function() {
console.log('info 的 wather');
});
Vue.delete(testVM.info, 'age'); //info 的wath处理函数并没有触发
Metadata
Metadata
Assignees
Labels
No labels