Browse Source

优化布局

master
guy 4 years ago
parent
commit
b765afb9a7
  1. 4
      src/core/plugin.js
  2. 28
      src/core/shortcut.js

4
src/core/plugin.js

@ -81,6 +81,10 @@ BI.Plugin = BI.Plugin || {};
return res || object; return res || object;
}, },
hasObject: function (type) {
return __GlobalObjectConfigFns.length > 0 || !!_ObjectPlugin[type];
},
registerObject: function (type, fn) { registerObject: function (type, fn) {
if (!_ObjectPlugin[type]) { if (!_ObjectPlugin[type]) {
_ObjectPlugin[type] = []; _ObjectPlugin[type] = [];

28
src/core/shortcut.js

@ -57,12 +57,14 @@
el = BI.extend({}, options, item); el = BI.extend({}, options, item);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
if (w.type === el.type) { if (w.type === el.type) {
w.listeners = (w.listeners || []).concat([{ if (BI.Plugin.hasObject(el.type)) {
eventName: BI.Events.MOUNT, w.listeners = (w.listeners || []).concat([{
action: function () { eventName: BI.Events.MOUNT,
BI.Plugin.getObject(el.type, this); action: function () {
} BI.Plugin.getObject(el.type, this);
}]); }
}]);
}
return createWidget(w, context, lazy); return createWidget(w, context, lazy);
} }
return BI.createWidget(w, options, context, lazy); return BI.createWidget(w, options, context, lazy);
@ -71,12 +73,14 @@
el = BI.extend({}, options, item.el); el = BI.extend({}, options, item.el);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
if (w.type === el.type) { if (w.type === el.type) {
w.listeners = (w.listeners || []).concat([{ if (BI.Plugin.hasObject(el.type)) {
eventName: BI.Events.MOUNT, w.listeners = (w.listeners || []).concat([{
action: function () { eventName: BI.Events.MOUNT,
BI.Plugin.getObject(el.type, this); action: function () {
} BI.Plugin.getObject(el.type, this);
}]); }
}]);
}
return createWidget(w, context, lazy); return createWidget(w, context, lazy);
} }
return BI.createWidget(w, options, context, lazy); return BI.createWidget(w, options, context, lazy);

Loading…
Cancel
Save