From e2b7d54c3555f49b249114cf10e0e5b055099c86 Mon Sep 17 00:00:00 2001 From: Young Date: Fri, 24 May 2019 13:51:58 +0800 Subject: [PATCH] =?UTF-8?q?BI-45290=20fix:=20=E7=BB=84=E4=BB=B61=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=E5=BA=95=E9=83=A8=E5=90=8E=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E6=98=BE=E7=A4=BA=E7=A9=BA=E7=99=BD=E6=88=96?= =?UTF-8?q?=E4=B8=80=E9=97=AA=E8=80=8C=E8=BF=87=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index 568bd4299..66b15a658 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -299,16 +299,22 @@ BI.Layout = BI.inherit(BI.Widget, { addItems: function (items, context) { var self = this, o = this.options; var fragment = BI.Widget._renderEngine.createFragment(); + var wrapper = this._getWrapper(); var added = []; BI.each(items, function (i, item) { var w = self._addElement(o.items.length, item, context); self._children[self._getChildName(o.items.length)] = w; o.items.push(item); added.push(w); - fragment.appendChild(w.element[0]); + var node = w.element[0]; + var childNodes = wrapper[0].childNodes; + // BI-45290 wrapper中已包含的node不需要再次添加(添加可能导致内部滚动条位置重置) + if (!BI.contains(childNodes, node)) { + fragment.appendChild(node); + } }); if (this._isMounted) { - this._getWrapper().append(fragment); + wrapper.append(fragment); BI.each(added, function (i, w) { w._mount(); }); @@ -605,4 +611,4 @@ BI.Layout = BI.inherit(BI.Widget, { } }); -BI.shortcut("bi.layout", BI.Layout); \ No newline at end of file +BI.shortcut("bi.layout", BI.Layout);