Browse Source

Pull request #1540: 无JIRA任务 context重构

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit 'b65546cd1e984dc8ee0d07b3c7f7b5f9c45d94ee':
  context重构
master
guy 4 years ago
parent
commit
d60d84257f
  1. 2
      dist/fix/fix.compact.ie.js
  2. 2
      dist/fix/fix.compact.js
  3. 16
      src/core/shortcut.js
  4. 3
      src/core/widget.js

2
dist/fix/fix.compact.ie.js vendored

@ -122,7 +122,7 @@
function createStore () { function createStore () {
var needPop = false; var needPop = false;
if (_global.Fix && this._store) { if (_global.Fix && this._store) {
var store = findStore(this.options.context || this._parent || this.options.element || this._context); var store = findStore(this.options.context || this._parent || this.options.element);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
needPop = true; needPop = true;

2
dist/fix/fix.compact.js vendored

@ -135,7 +135,7 @@
function createStore () { function createStore () {
var needPop = false; var needPop = false;
if (_global.Fix && this._store) { if (_global.Fix && this._store) {
var store = findStore(this.options.context || this._parent || this.options.element || this._context); var store = findStore(this.options.context || this._parent || this.options.element);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
needPop = true; needPop = true;

16
src/core/shortcut.js

@ -17,16 +17,18 @@
if (!cls) { if (!cls) {
throw new Error("组件" + config.type + "未定义"); throw new Error("组件" + config.type + "未定义");
} }
var pushed = false;
if (context) {
pushed = true;
BI.Widget.pushContext(context);
}
var widget = new cls(); var widget = new cls();
widget._context = context;
BI.Widget.pushContext(widget);
widget._initProps(config); widget._initProps(config);
widget._initRoot(); widget._initRoot();
if (!lazy || config.element || config.root) { // if (!lazy || config.element || config.root) {
widget._lazyConstructor(); widget._lazyConstructor();
} // }
BI.Widget.popContext(); pushed && BI.Widget.popContext();
return widget; return widget;
}; };

3
src/core/widget.js

@ -338,9 +338,6 @@
throw new Error("name has already been existed"); throw new Error("name has already been existed");
} }
widget._setParent && widget._setParent(this); widget._setParent && widget._setParent(this);
BI.Widget.pushContext(widget);
widget._lazyConstructor();
BI.Widget.popContext();
widget.on(BI.Events.DESTROY, function () { widget.on(BI.Events.DESTROY, function () {
BI.remove(self._children, this); BI.remove(self._children, this);
}); });

Loading…
Cancel
Save