From 8cc5ed019917c62da81f7de80c1606b180e46890 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 26 Sep 2022 22:18:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore=EF=BC=9A=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/list/virtualgrouplist.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/base/list/virtualgrouplist.js b/src/base/list/virtualgrouplist.js index a4a811c73..34b11e800 100644 --- a/src/base/list/virtualgrouplist.js +++ b/src/base/list/virtualgrouplist.js @@ -27,7 +27,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; - + return { type: "bi.vertical", items: [{ @@ -97,12 +97,13 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { this.container[self.renderedIndex === -1 ? "populate" : "addItems"](items.map(function (item, i) { return o.itemFormatter(item, index + i); }), this); - var addedHeight = getElementHeight() - lastHeight; + var elementHeight = getElementHeight(); + var addedHeight = elementHeight - lastHeight; this.tree.set(cnt, addedHeight); this.renderedIndex = cnt; cnt++; index += o.blockSize; - lastHeight = this.renderedIndex === -1 ? 0 : getElementHeight(); + lastHeight = this.renderedIndex === -1 ? 0 : elementHeight; } }, From 422594d6da2558330543629185c7b9645640b3aa Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 3 Oct 2022 16:28:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feature:=20=E6=94=AF=E6=8C=81type=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=9B=B4=E6=8E=A5=E4=BC=A0=E5=87=BD=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E6=B2=A1=E6=9C=89xtype=E9=83=BD=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/5.inject.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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); } }]); }