From a2e8bbf767a541f2f3643c9e87a1fa189121f7be Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 24 Nov 2017 15:28:31 +0800 Subject: [PATCH] update --- dist/fix/fix.js | 177 ++++++++++++++++++++++++------------------------ 1 file changed, 87 insertions(+), 90 deletions(-) diff --git a/dist/fix/fix.js b/dist/fix/fix.js index 7f161b64d..54ff8f071 100644 --- a/dist/fix/fix.js +++ b/dist/fix/fix.js @@ -469,56 +469,53 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons function defineReactive(obj, observer, shallow) { var props = {}; var model = void 0; - if (typeof Proxy === 'function') { - var deps = {}, - childObs = {}, - cache = {}; - _.each(obj, function (val, key) { - if (key in $$skipArray) { - return; - } - cache[key] = val; - var dep = deps[key] = observer && observer['__dep' + key] || new Dep(); - observer && (observer['__dep' + key] = dep); - childObs[key] = !shallow && observe(val, observer, key); - }); - return model = new Proxy(props, { - has: function has(target, key) { - return key in obj; - }, - get: function get(target, key) { - if (key in $$skipArray) { - return target[key]; - } - var value = cache[key]; - if (Dep.target) { - deps[key].depend(); - if (childObs[key]) { - childObs[key].dep.depend(); - if (_.isArray(value)) { - dependArray(value); - } - } - } - return value; - }, - set: function set(target, key, newVal) { - if (key in $$skipArray) { - return target[key] = newVal; - } - var value = cache[key], - dep = deps[key]; - if (newVal === value || newVal !== newVal && value !== value) { - return newVal; - } - cache[key] = newVal; - childObs[key] = !shallow && observe(newVal, observer, key); - obj[key] = childObs[key] ? childObs[key].model : newVal; - notify(model, key, dep); - return obj[key]; - } - }); - } + // if (typeof Proxy === 'function') { + // const deps = {}, childObs = {}, cache = {} + // _.each(obj, function (val, key) { + // if (key in $$skipArray) { + // return + // } + // cache[key] = val + // const dep = deps[key] = (observer && observer['__dep' + key]) || new Dep() + // observer && (observer['__dep' + key] = dep) + // childObs[key] = !shallow && observe(val, observer, key) + // }) + // return model = new Proxy(props, { + // has: function (target, key) { + // return key in obj; + // }, + // get: function (target, key) { + // if (key in $$skipArray) { + // return target[key] + // } + // const value = cache[key] + // if (Dep.target) { + // deps[key].depend() + // if (childObs[key]) { + // childObs[key].dep.depend() + // if (_.isArray(value)) { + // dependArray(value) + // } + // } + // } + // return value + // }, + // set: function (target, key, newVal) { + // if (key in $$skipArray) { + // return target[key] = newVal + // } + // const value = cache[key], dep = deps[key] + // if (newVal === value || (newVal !== newVal && value !== value)) { + // return newVal + // } + // cache[key] = newVal + // childObs[key] = !shallow && observe(newVal, observer, key) + // obj[key] = childObs[key] ? childObs[key].model : newVal + // notify(model, key, dep) + // return obj[key] + // } + // }) + // } _.each(obj, function (val, key) { if (key in $$skipArray) { return; @@ -893,16 +890,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons function defineComputed(vm, computed) { var props = {}; - if (typeof Proxy === 'function') { - return vm.$$computed = new Proxy(props, { - has: function has(target, key) { - return computed && key in computed; - }, - get: function get(target, key) { - return createComputedGetter(vm, key)(); - } - }); - } + // if (typeof Proxy === 'function') { + // return vm.$$computed = new Proxy(props, { + // has: function (target, key) { + // return computed && key in computed + // }, + // get: function (target, key) { + // return createComputedGetter(vm, key)() + // } + // }) + // } var shouldCache = true; for (var key in computed) { if (!(key in vm)) { @@ -968,36 +965,36 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons function defineProps(vm, keys) { var props = {}; - if (typeof Proxy === 'function') { - return vm.model = new Proxy(props, { - has: function has(target, key) { - return keys.indexOf(key) > -1; - }, - get: function get(target, key) { - if (key in $$skipArray) { - return props[key]; - } - if (vm.$$computed && key in vm.$$computed) { - return vm.$$computed[key]; - } - if (vm.$$state && key in vm.$$state) { - return vm.$$state[key]; - } - return vm.$$model[key]; - }, - set: function set(target, key, val) { - if (key in $$skipArray) { - return props[key] = val; - } - if (vm.$$state && key in vm.$$state) { - return vm.$$state[key] = val; - } - if (vm.$$model && key in vm.$$model) { - return vm.$$model[key] = val; - } - } - }); - } + // if (typeof Proxy === 'function') { + // return vm.model = new Proxy(props, { + // has: function (target, key) { + // return keys.indexOf(key) > -1; + // }, + // get: function (target, key) { + // if (key in $$skipArray) { + // return props[key] + // } + // if (vm.$$computed && key in vm.$$computed) { + // return vm.$$computed[key] + // } + // if (vm.$$state && key in vm.$$state) { + // return vm.$$state[key] + // } + // return vm.$$model[key] + // }, + // set: function (target, key, val) { + // if (key in $$skipArray) { + // return props[key] = val + // } + // if (vm.$$state && key in vm.$$state) { + // return vm.$$state[key] = val + // } + // if (vm.$$model && key in vm.$$model) { + // return vm.$$model[key] = val + // } + // } + // }) + // } var _loop = function _loop(i, len) { var key = keys[i];