guy 7 years ago
parent
commit
680777573f
  1. 13
      dist/fix/fix.compact.js

13
dist/fix/fix.compact.js vendored

@ -60,14 +60,20 @@
widget.__cacheStore = p.store; widget.__cacheStore = p.store;
return p.__cacheStore || p.store; return p.__cacheStore || p.store;
} }
throw new Error("找不到store");
} }
var _init = BI.Widget.prototype._init; var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () { BI.Widget.prototype._init = function () {
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (window.Fix && this._store) {
var store = findStore(this.options.element);
if (store) {
pushTarget(store);
needPop = true;
}
this.store = this._store(); this.store = this._store();
needPop && popTarget();
needPop = false;
pushTarget(this.store); pushTarget(this.store);
if (this.store instanceof Fix.Model) { if (this.store instanceof Fix.Model) {
this.model = this.store.model; this.model = this.store.model;
@ -98,10 +104,9 @@
_.each(["_mount", "populate"], function (name) { _.each(["_mount", "populate"], function (name) {
var old = BI.Widget.prototype[name]; var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () { old && (BI.Widget.prototype[name] = function () {
var store = findStore(this); this.store && pushTarget(this.store);
store && pushTarget(store);
var res = old.apply(this, arguments); var res = old.apply(this, arguments);
store && popTarget(); this.store && popTarget();
return res; return res;
}); });
}); });

Loading…
Cancel
Save