diff --git a/src/core/base.js b/src/core/base.js index b7948bf33..2bdc87d65 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -70,7 +70,7 @@ if (!_global.BI) { }, isWidget: function (widget) { - return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); + return widget instanceof BI.Widget; }, createWidgets: function (items, options, context) { @@ -107,7 +107,7 @@ if (!_global.BI) { el: innerAttr.shift() }); } - if (item.el instanceof BI.Widget || (BI.View && item.el instanceof BI.View)) { + if (item.el instanceof BI.Widget) { innerAttr.shift(); return BI.extend({}, outerAttr.shift(), { type: null }, item); } diff --git a/src/core/shortcut.js b/src/core/shortcut.js index 9f3b8492b..704d2a6b9 100644 --- a/src/core/shortcut.js +++ b/src/core/shortcut.js @@ -18,11 +18,12 @@ throw new Error("组件" + config.type + "未定义"); } var pushed = false; - if (context) { + var widget = new cls(); + widget._context = BI.Widget.context || context; + if (!BI.Widget.context && context) { pushed = true; BI.Widget.pushContext(context); } - var widget = new cls(); widget._initProps(config); widget._constructed(); widget._initRoot(); diff --git a/src/core/widget.js b/src/core/widget.js index 42628f1d4..f398de5d4 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -152,16 +152,9 @@ this._children = {}; if (BI.isWidget(o.element)) { this.element = this.options.element.element; - if (o.element instanceof BI.Widget) { - this._parent = o.element; - this._parent.addWidget(this.widgetName, this); - } else { - this._isRoot = true; - } + this._parent = o.element; + this._parent.addWidget(this.widgetName, this); } else if (o.element) { - // if (o.root !== true) { - // throw new Error("root is a required property"); - // } this.element = BI.Widget._renderEngine.createElement(this); this._isRoot = true; } else {