From 3c2e452142daa6f78f8391acaadd35a49d3ecc5a Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 24 Nov 2017 12:33:28 +0800 Subject: [PATCH] update --- demo/js/fix-2.0/computed.js | 2 +- demo/js/fix-2.0/demo.js | 2 +- demo/js/fix-2.0/scene.js | 2 +- demo/js/fix-2.0/state.js | 2 +- demo/js/fix-2.0/store.js | 2 +- dist/demo.js | 10 +++++----- dist/fix/fix.js | 23 ++++++++++++----------- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/demo/js/fix-2.0/computed.js b/demo/js/fix-2.0/computed.js index 347dae96b..8153bd2b8 100644 --- a/demo/js/fix-2.0/computed.js +++ b/demo/js/fix-2.0/computed.js @@ -7,7 +7,7 @@ n: 'b' }] }); - var Computed = BI.inherit(Fix.VM, { + var Computed = BI.inherit(Fix.Model, { computed: { b: function () { return this.name + "-计算属性" diff --git a/demo/js/fix-2.0/demo.js b/demo/js/fix-2.0/demo.js index b6fb8fc54..c2fe7f688 100644 --- a/demo/js/fix-2.0/demo.js +++ b/demo/js/fix-2.0/demo.js @@ -7,7 +7,7 @@ n: 0 }] }); - var Computed = BI.inherit(Fix.VM, { + var Computed = BI.inherit(Fix.Model, { computed: { b: function () { return this.name + 1 diff --git a/demo/js/fix-2.0/scene.js b/demo/js/fix-2.0/scene.js index 6f34e34a3..ff28a0b9e 100644 --- a/demo/js/fix-2.0/scene.js +++ b/demo/js/fix-2.0/scene.js @@ -386,7 +386,7 @@ }); BI.shortcut("demo.fix_scene_field", Demo.FixSceneField); - Demo.FixSceneFineIndexUpdateStore = BI.inherit(Fix.VM, { + Demo.FixSceneFineIndexUpdateStore = BI.inherit(Fix.Model, { _init: function () { this.fineIndexUpdate = model.fineIndexUpdate; }, diff --git a/demo/js/fix-2.0/state.js b/demo/js/fix-2.0/state.js index 315154259..de791ae7a 100644 --- a/demo/js/fix-2.0/state.js +++ b/demo/js/fix-2.0/state.js @@ -1,5 +1,5 @@ ;(function () { - var State = BI.inherit(Fix.VM, { + var State = BI.inherit(Fix.Model, { state: function () { return { name: "原始属性" diff --git a/demo/js/fix-2.0/store.js b/demo/js/fix-2.0/store.js index 30c93e203..07c4a0c63 100644 --- a/demo/js/fix-2.0/store.js +++ b/demo/js/fix-2.0/store.js @@ -8,7 +8,7 @@ }] }); - var Store = BI.inherit(Fix.VM, { + var Store = BI.inherit(Fix.Model, { _init: function () { }, computed: { diff --git a/dist/demo.js b/dist/demo.js index cdd4a6cd4..858266302 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -9997,7 +9997,7 @@ BI.shortcut("demo.tmp", Demo.Func); n: 'b' }] }); - var Computed = BI.inherit(Fix.VM, { + var Computed = BI.inherit(Fix.Model, { computed: { b: function () { return this.name + "-计算属性" @@ -10093,7 +10093,7 @@ BI.shortcut("demo.tmp", Demo.Func); n: 0 }] }); - var Computed = BI.inherit(Fix.VM, { + var Computed = BI.inherit(Fix.Model, { computed: { b: function () { return this.name + 1 @@ -10597,7 +10597,7 @@ BI.shortcut("demo.tmp", Demo.Func); }); BI.shortcut("demo.fix_scene_field", Demo.FixSceneField); - Demo.FixSceneFineIndexUpdateStore = BI.inherit(Fix.VM, { + Demo.FixSceneFineIndexUpdateStore = BI.inherit(Fix.Model, { _init: function () { this.fineIndexUpdate = model.fineIndexUpdate; }, @@ -10654,7 +10654,7 @@ BI.shortcut("demo.tmp", Demo.Func); BI.shortcut("demo.fix_scene_fine_index_update", Demo.FixSceneFineIndexUpdate); })();;(function () { - var State = BI.inherit(Fix.VM, { + var State = BI.inherit(Fix.Model, { state: function () { return { name: "原始属性" @@ -10711,7 +10711,7 @@ BI.shortcut("demo.tmp", Demo.Func); }] }); - var Store = BI.inherit(Fix.VM, { + var Store = BI.inherit(Fix.Model, { _init: function () { }, computed: { diff --git a/dist/fix/fix.js b/dist/fix/fix.js index b09e70b98..7f161b64d 100644 --- a/dist/fix/fix.js +++ b/dist/fix/fix.js @@ -824,9 +824,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons // remove self from vm's watcher list // this is a somewhat expensive operation so we skip it // if the vm is being destroyed. - if (!this.vm._isBeingDestroyed) { - remove(this.vm._watchers, this); - } + remove(this.vm._watchers, this); var i = this.deps.length; while (i--) { this.deps[i].removeSub(this); @@ -1034,11 +1032,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons vm.model = createViewModel$1({}, props); } - var VM = function () { - function VM(model) { - _classCallCheck(this, VM); + var Model = function () { + function Model(model) { + _classCallCheck(this, Model); - if (model instanceof Observer || model instanceof VM) { + if (model instanceof Observer || model instanceof Model) { model = model.model; } if (_.has(model, '__ob__')) { @@ -1060,9 +1058,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons } } - VM.prototype._init = function _init() {}; + Model.prototype._init = function _init() {}; - VM.prototype.destroy = function destroy() { + Model.prototype.destroy = function destroy() { for (var _key3 in this._computedWatchers) { this._computedWatchers[_key3].teardown(); } @@ -1074,9 +1072,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons }); this._watchers && (this._watchers = []); this.destroyed && this.destroyed(); + this.$$model = null; + this.$$computed = null; + this.$$state = null; }; - return VM; + return Model; }(); var falsy$1; @@ -1249,7 +1250,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons exports.define = define; exports.version = version; exports.$$skipArray = $$skipArray; - exports.VM = VM; + exports.Model = Model; exports.observerState = observerState; exports.Observer = Observer; exports.observe = observe;