From 33858e9c52be02efedd02a2cdd7ade935cdb986d Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 25 Jan 2018 15:14:17 +0800 Subject: [PATCH] update --- dist/fix/fix.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dist/fix/fix.js b/dist/fix/fix.js index 93741dd6c..f812d8e1e 100644 --- a/dist/fix/fix.js +++ b/dist/fix/fix.js @@ -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 () {