|
|
@ -919,23 +919,27 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
return m; |
|
|
|
return m; |
|
|
|
} : parsePath(exp); |
|
|
|
} : parsePath(exp); |
|
|
|
var v = getter.call(model, model); |
|
|
|
var v = getter.call(model, model); |
|
|
|
var _dep = new Dep(); |
|
|
|
|
|
|
|
if (isGlobal) { |
|
|
|
if (v.__ob__) { |
|
|
|
(v.__ob__._scopeDeps || (v.__ob__._scopeDeps = [])).push(_dep); |
|
|
|
var _dep = new Dep(); |
|
|
|
} else { |
|
|
|
if (isGlobal) { |
|
|
|
(v.__ob__._deps || (v.__ob__._deps = [])).push(_dep); |
|
|
|
(v.__ob__._scopeDeps || (v.__ob__._scopeDeps = [])).push(_dep); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
(v.__ob__._deps || (v.__ob__._deps = [])).push(_dep); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var _w = new Watcher(model, function () { |
|
|
|
|
|
|
|
_dep.depend(); |
|
|
|
|
|
|
|
return NaN; |
|
|
|
|
|
|
|
}, function (newValue, oldValue, attrs) { |
|
|
|
|
|
|
|
callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs)); |
|
|
|
|
|
|
|
}, options); |
|
|
|
|
|
|
|
watchers.push(function unwatchFn() { |
|
|
|
|
|
|
|
_w.teardown(); |
|
|
|
|
|
|
|
v.__ob__._scopeDeps && remove(v.__ob__._scopeDeps, _dep); |
|
|
|
|
|
|
|
v.__ob__._deps && remove(v.__ob__._deps, _dep); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
var _w = new Watcher(model, function () { |
|
|
|
|
|
|
|
_dep.depend(); |
|
|
|
|
|
|
|
return NaN; |
|
|
|
|
|
|
|
}, function (newValue, oldValue, attrs) { |
|
|
|
|
|
|
|
callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs)); |
|
|
|
|
|
|
|
}, options); |
|
|
|
|
|
|
|
watchers.push(function unwatchFn() { |
|
|
|
|
|
|
|
_w.teardown(); |
|
|
|
|
|
|
|
v.__ob__._scopeDeps && remove(v.__ob__._scopeDeps, _dep); |
|
|
|
|
|
|
|
v.__ob__._deps && remove(v.__ob__._deps, _dep); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// **.a.**的情况,场景:a.b.c, 如果用b.**监听, a被重新赋值b上的_scopeDes就不存在了
|
|
|
|
// **.a.**的情况,场景:a.b.c, 如果用b.**监听, a被重新赋值b上的_scopeDes就不存在了
|
|
|
@ -943,6 +947,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
//先获取到能获取到的对象
|
|
|
|
//先获取到能获取到的对象
|
|
|
|
var _paths = exp.split("."); |
|
|
|
var _paths = exp.split("."); |
|
|
|
var _currentModel = model[_paths[1]]; |
|
|
|
var _currentModel = model[_paths[1]]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!_currentModel.__ob__) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
exp = _paths[1] + ".**"; |
|
|
|
exp = _paths[1] + ".**"; |
|
|
|
//补全路径
|
|
|
|
//补全路径
|
|
|
|
var _parent = _currentModel.__ob__.parent, |
|
|
|
var _parent = _currentModel.__ob__.parent, |
|
|
@ -993,6 +1002,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
} |
|
|
|
} |
|
|
|
currentModel = model[paths[_i]]; |
|
|
|
currentModel = model[paths[_i]]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!currentModel.__ob__) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
exp = exp.substr(exp.indexOf("*")); |
|
|
|
exp = exp.substr(exp.indexOf("*")); |
|
|
|
//补全路径
|
|
|
|
//补全路径
|
|
|
|
var parent = currentModel.__ob__.parent, |
|
|
|
var parent = currentModel.__ob__.parent, |
|
|
|