From 30801d2f9cae286acd8119925b95683676c15173 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 19 Oct 2021 11:11:06 +0800 Subject: [PATCH] =?UTF-8?q?addItemAt=E4=BF=9D=E6=8C=81=E5=8E=9F=E6=9D=A5?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index 805550039..01ff69be8 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -309,11 +309,11 @@ BI.Layout = BI.inherit(BI.Widget, { } this._addItemAt(index, item); var w = this._addElement(index, item); - var nextSibling = this._children[this._getChildName(index)].element[0].nextSibling; - if (nextSibling) { - BI.Widget._renderEngine.createElement(nextSibling).before(w.element); + // addItemAt 还是用之前的找上个兄弟节点向后插入的方式 + if (index > 0) { + this._children[this._getChildName(index - 1)].element.after(w.element); } else { - w.element.appendTo(this._getWrapper()); + w.element.prependTo(this._getWrapper()); } w._mount(); return w;