diff --git a/src/core/5.inject.js b/src/core/5.inject.js index 9e0ae8503..0554740f7 100644 --- a/src/core/5.inject.js +++ b/src/core/5.inject.js @@ -411,7 +411,7 @@ // 根据配置属性生成widget var createWidget = function (config, context, lazy) { - var cls = kv[config.type]; + var cls = BI.isFunction(config.type) ? config.type : kv[config.type]; if (!cls) { throw new Error("组件: [" + config.type + "] 未定义"); @@ -449,9 +449,10 @@ } else if (item.el && (item.el.type || options.type)) { el = BI.extend({}, options, item.el); } - + if (el) { - runConfigFunction(el.type); + var elType = (el.type && el.type.xtype) || el.type; + runConfigFunction(elType); } // 先把准备环境准备好 @@ -466,13 +467,14 @@ return item; } if (el) { - w = BI.Plugin.getWidget(el.type, el); - if (w.type === el.type) { - if (BI.Plugin.hasObject(el.type)) { + w = BI.Plugin.getWidget(elType, el); + var wType = (w.type && w.type.xtype) || w.type; + if (wType === elType) { + if (BI.Plugin.hasObject(elType)) { w.listeners = (w.listeners || []).concat([{ eventName: BI.Events.MOUNT, action: function () { - BI.Plugin.getObject(el.type, this); + BI.Plugin.getObject(elType, this); } }]); }