Browse Source

addItemAt保持原来的逻辑

es6
guy 3 years ago
parent
commit
30801d2f9c
  1. 8
      src/core/wrapper/layout.js

8
src/core/wrapper/layout.js

@ -309,11 +309,11 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
this._addItemAt(index, item); this._addItemAt(index, item);
var w = this._addElement(index, item); var w = this._addElement(index, item);
var nextSibling = this._children[this._getChildName(index)].element[0].nextSibling; // addItemAt 还是用之前的找上个兄弟节点向后插入的方式
if (nextSibling) { if (index > 0) {
BI.Widget._renderEngine.createElement(nextSibling).before(w.element); this._children[this._getChildName(index - 1)].element.after(w.element);
} else { } else {
w.element.appendTo(this._getWrapper()); w.element.prependTo(this._getWrapper());
} }
w._mount(); w._mount();
return w; return w;

Loading…
Cancel
Save