From 52abc4a1e471ffef9baf3fefed3f804633911bf4 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 12:30:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/shortcut.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/core/shortcut.js b/src/core/shortcut.js index 704d2a6b9..aa4a3b916 100644 --- a/src/core/shortcut.js +++ b/src/core/shortcut.js @@ -56,24 +56,30 @@ if (item.type || options.type) { el = BI.extend({}, options, item); w = BI.Plugin.getWidget(el.type, el); - w.listeners = (w.listeners || []).concat([{ - eventName: BI.Events.MOUNT, - action: function () { - BI.Plugin.getObject(el.type, this); - } - }]); - return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({/**important**/}, el, {type: w.type}), options, context, lazy); + if (w.type === el.type) { + w.listeners = (w.listeners || []).concat([{ + eventName: BI.Events.MOUNT, + action: function () { + BI.Plugin.getObject(el.type, this); + } + }]); + return createWidget(w, context, lazy); + } + return BI.createWidget(w, options, context, lazy); } if (item.el && (item.el.type || options.type)) { el = BI.extend({}, options, item.el); w = BI.Plugin.getWidget(el.type, el); - w.listeners = (w.listeners || []).concat([{ - eventName: BI.Events.MOUNT, - action: function () { - BI.Plugin.getObject(el.type, this); - } - }]); - return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({/**important**/}, el, {type: w.type}), options, context, lazy); + if (w.type === el.type) { + w.listeners = (w.listeners || []).concat([{ + eventName: BI.Events.MOUNT, + action: function () { + BI.Plugin.getObject(el.type, this); + } + }]); + return createWidget(w, context, lazy); + } + return BI.createWidget(w, options, context, lazy); } if (BI.isWidget(item.el)) { return item.el;