From a852815a42e226cea55be469a26c6f0bbc447e22 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 30 Oct 2017 20:49:34 +0800 Subject: [PATCH] update --- dist/fix/fix.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dist/fix/fix.js b/dist/fix/fix.js index ee896237f..3b1cacddd 100644 --- a/dist/fix/fix.js +++ b/dist/fix/fix.js @@ -875,10 +875,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return vm.$watch(keyOrFn, handler, options); } + var falsy$1; + var operators = { + '||': falsy$1, + '&&': falsy$1, + '(': falsy$1, + ')': falsy$1 + }; + function runBinaryFunction(binarys) { var expr = ''; for (var i = 0, len = binarys.length; i < len; i++) { - if (_.isBoolean(binarys[i]) || binarys[i] === '||' || binarys[i] === '&&' || binarys[i] === '(' || binarys[i] === ')') { + if (_.isBoolean(binarys[i]) || _.has(operators, binarys[i])) { expr += binarys[i]; } else { expr += 'false'; @@ -940,7 +948,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons options = options || {}; options.user = true; var exps = void 0; - if (_.isFunction(expOrFn) || (exps = expOrFn.match(/[a-zA-Z0-9_.]+|[|][|]|[&][&]|[(]|[)]/g)) && exps.length === 1) { + if (_.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1) { var watcher = new Watcher(vm.model, expOrFn, _.bind(cb, vm), options); if (options.immediate) { cb.call(vm, watcher.value); @@ -953,7 +961,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons var fns = exps.slice(); var complete = false; _.each(exps, function (exp, i) { - if (exp === '||' || exp === '&&' || exp === '(' || exp === ')') { + if (_.has(operators, exp)) { return; } var watcher = new Watcher(vm.model, exp, function () {