From 91704a0b9d9d2f29d0282b18124938527d752a98 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 2 Nov 2017 23:47:38 +0800 Subject: [PATCH] update --- dist/fix/fix.compact.js | 2 +- dist/fix/fix.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/fix/fix.compact.js b/dist/fix/fix.compact.js index 8aa5de97c0..5815e1b1a1 100644 --- a/dist/fix/fix.compact.js +++ b/dist/fix/fix.compact.js @@ -14,7 +14,7 @@ } function createWatcher(vm, keyOrFn, handler, options) { - return Fix.watch(vm, keyOrFn, handler, options) + return Fix.watch(vm.model, keyOrFn, _.bind(handler, vm), options) } var _init = BI.Widget.prototype._init; diff --git a/dist/fix/fix.js b/dist/fix/fix.js index eb07f6726f..1b4a794e18 100644 --- a/dist/fix/fix.js +++ b/dist/fix/fix.js @@ -887,21 +887,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons } return new Function('return ' + expr)(); } - function watch(vm, expOrFn, cb, options) { + function watch(model, expOrFn, cb, options) { if (isPlainObject(cb)) { options = cb; cb = cb.handler; } if (typeof cb === 'string') { - cb = vm[cb]; + cb = model[cb]; } options = options || {}; options.user = true; var exps = void 0; if (_.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) { - var watcher = new Watcher(vm.model, expOrFn, _.bind(cb, vm), options); + var watcher = new Watcher(model, expOrFn, cb, options); if (options.immediate) { - cb.call(vm, watcher.value); + cb(watcher.value); } return function unwatchFn() { watcher.teardown(); @@ -925,17 +925,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons exp = exp.replace(".*", ""); } var getter = parsePath(exp); - var v = getter.call(vm.model, vm.model); + var v = getter.call(model, model); var dep = new Dep(); if (isGlobal) { (v.__ob__._globalDeps || (v.__ob__._globalDeps = [])).push(dep); } else { (v.__ob__._deps || (v.__ob__._deps = [])).push(dep); } - var w = new Watcher(vm.model, function () { + var w = new Watcher(model, function () { dep.depend(); return NaN; - }, _.bind(cb, vm)); + }, cb); watchers.push(function unwatchFn() { w.teardown(); v.__ob__._globalDeps && remove(v.__ob__._globalDeps, dep); @@ -943,14 +943,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons }); return; } - var watcher = new Watcher(vm.model, exp, function () { + var watcher = new Watcher(model, exp, function () { if (complete === true) { return; } fns[i] = true; if (runBinaryFunction(fns)) { complete = true; - cb.call(vm); + cb(); } if (!running) { running = true;