guy 7 years ago
parent
commit
3c2e452142
  1. 2
      demo/js/fix-2.0/computed.js
  2. 2
      demo/js/fix-2.0/demo.js
  3. 2
      demo/js/fix-2.0/scene.js
  4. 2
      demo/js/fix-2.0/state.js
  5. 2
      demo/js/fix-2.0/store.js
  6. 10
      dist/demo.js
  7. 21
      dist/fix/fix.js

2
demo/js/fix-2.0/computed.js

@ -7,7 +7,7 @@
n: 'b' n: 'b'
}] }]
}); });
var Computed = BI.inherit(Fix.VM, { var Computed = BI.inherit(Fix.Model, {
computed: { computed: {
b: function () { b: function () {
return this.name + "-计算属性" return this.name + "-计算属性"

2
demo/js/fix-2.0/demo.js

@ -7,7 +7,7 @@
n: 0 n: 0
}] }]
}); });
var Computed = BI.inherit(Fix.VM, { var Computed = BI.inherit(Fix.Model, {
computed: { computed: {
b: function () { b: function () {
return this.name + 1 return this.name + 1

2
demo/js/fix-2.0/scene.js

@ -386,7 +386,7 @@
}); });
BI.shortcut("demo.fix_scene_field", Demo.FixSceneField); BI.shortcut("demo.fix_scene_field", Demo.FixSceneField);
Demo.FixSceneFineIndexUpdateStore = BI.inherit(Fix.VM, { Demo.FixSceneFineIndexUpdateStore = BI.inherit(Fix.Model, {
_init: function () { _init: function () {
this.fineIndexUpdate = model.fineIndexUpdate; this.fineIndexUpdate = model.fineIndexUpdate;
}, },

2
demo/js/fix-2.0/state.js

@ -1,5 +1,5 @@
;(function () { ;(function () {
var State = BI.inherit(Fix.VM, { var State = BI.inherit(Fix.Model, {
state: function () { state: function () {
return { return {
name: "原始属性" name: "原始属性"

2
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 () { _init: function () {
}, },
computed: { computed: {

10
dist/demo.js vendored

@ -9997,7 +9997,7 @@ BI.shortcut("demo.tmp", Demo.Func);
n: 'b' n: 'b'
}] }]
}); });
var Computed = BI.inherit(Fix.VM, { var Computed = BI.inherit(Fix.Model, {
computed: { computed: {
b: function () { b: function () {
return this.name + "-计算属性" return this.name + "-计算属性"
@ -10093,7 +10093,7 @@ BI.shortcut("demo.tmp", Demo.Func);
n: 0 n: 0
}] }]
}); });
var Computed = BI.inherit(Fix.VM, { var Computed = BI.inherit(Fix.Model, {
computed: { computed: {
b: function () { b: function () {
return this.name + 1 return this.name + 1
@ -10597,7 +10597,7 @@ BI.shortcut("demo.tmp", Demo.Func);
}); });
BI.shortcut("demo.fix_scene_field", Demo.FixSceneField); BI.shortcut("demo.fix_scene_field", Demo.FixSceneField);
Demo.FixSceneFineIndexUpdateStore = BI.inherit(Fix.VM, { Demo.FixSceneFineIndexUpdateStore = BI.inherit(Fix.Model, {
_init: function () { _init: function () {
this.fineIndexUpdate = model.fineIndexUpdate; this.fineIndexUpdate = model.fineIndexUpdate;
}, },
@ -10654,7 +10654,7 @@ BI.shortcut("demo.tmp", Demo.Func);
BI.shortcut("demo.fix_scene_fine_index_update", Demo.FixSceneFineIndexUpdate); BI.shortcut("demo.fix_scene_fine_index_update", Demo.FixSceneFineIndexUpdate);
})();;(function () { })();;(function () {
var State = BI.inherit(Fix.VM, { var State = BI.inherit(Fix.Model, {
state: function () { state: function () {
return { return {
name: "原始属性" 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 () { _init: function () {
}, },
computed: { computed: {

21
dist/fix/fix.js vendored

@ -824,9 +824,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// remove self from vm's watcher list // remove self from vm's watcher list
// this is a somewhat expensive operation so we skip it // this is a somewhat expensive operation so we skip it
// if the vm is being destroyed. // 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; var i = this.deps.length;
while (i--) { while (i--) {
this.deps[i].removeSub(this); this.deps[i].removeSub(this);
@ -1034,11 +1032,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
vm.model = createViewModel$1({}, props); vm.model = createViewModel$1({}, props);
} }
var VM = function () { var Model = function () {
function VM(model) { function Model(model) {
_classCallCheck(this, VM); _classCallCheck(this, Model);
if (model instanceof Observer || model instanceof VM) { if (model instanceof Observer || model instanceof Model) {
model = model.model; model = model.model;
} }
if (_.has(model, '__ob__')) { 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) { for (var _key3 in this._computedWatchers) {
this._computedWatchers[_key3].teardown(); this._computedWatchers[_key3].teardown();
} }
@ -1074,9 +1072,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}); });
this._watchers && (this._watchers = []); this._watchers && (this._watchers = []);
this.destroyed && this.destroyed(); this.destroyed && this.destroyed();
this.$$model = null;
this.$$computed = null;
this.$$state = null;
}; };
return VM; return Model;
}(); }();
var falsy$1; var falsy$1;
@ -1249,7 +1250,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.define = define; exports.define = define;
exports.version = version; exports.version = version;
exports.$$skipArray = $$skipArray; exports.$$skipArray = $$skipArray;
exports.VM = VM; exports.Model = Model;
exports.observerState = observerState; exports.observerState = observerState;
exports.Observer = Observer; exports.Observer = Observer;
exports.observe = observe; exports.observe = observe;

Loading…
Cancel
Save