Browse Source

update

master
guy 7 years ago
parent
commit
33858e9c52
  1. 18
      dist/fix/fix.js

18
dist/fix/fix.js vendored

@ -998,11 +998,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
if (/\*\*$|\*$/.test(exp)) {
throw new Error('not support');
}
//其他含有*的情况,如*.a,*.*.a,a.*.a.*
//其他含有*的情况,如*.a,*.*.a,a.*.a
if (/\*/.test(exp)) {
var currentModel = model;
//先获取到能获取到的对象
var paths = exp.split(".");
for (var _i = 0, len = paths.length; _i < len; _i++) {
if (paths[_i] === "*") {
break;
}
currentModel = model[paths[_i]];
}
exp = exp.substr(exp.indexOf("*"));
//补全路径
var parent = model.__ob__.parent,
root = model.__ob__;
var parent = currentModel.__ob__.parent,
root = currentModel.__ob__;
while (parent) {
exp = '*.' + exp;
root = parent;
@ -1013,7 +1023,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
root._globalDeps || (root._globalDeps = {});
root._globalDeps[regStr] = _dep;
var _w = new Watcher(model, function () {
var _w = new Watcher(currentModel, function () {
_dep.depend();
return NaN;
}, function () {

Loading…
Cancel
Save