diff --git a/examples/dev.html b/examples/dev.html index beaaff545..6afcc3589 100644 --- a/examples/dev.html +++ b/examples/dev.html @@ -9,85 +9,6 @@
- + + +
+ + + + diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index 6ef83324f..b8a2615f1 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -441,10 +441,10 @@ BI.Layout = BI.inherit(BI.Widget, { } else { var sameOldVnode = findOldVnode(oldCh, newStartVnode, oldStartIdx, oldEndIdx); if (BI.isNull(sameOldVnode)) { // 不存在就把新的放到左边 + delete self._children[self._getChildName(newStartIdx)]; var node = addNode(newStartVnode, newStartIdx); insertBefore(node, oldStartVnode); - newStartVnode = newCh[++newStartIdx]; - } else { // 如果新节点在就旧节点区间中存在就复用一下 + } else { // 如果新节点在旧节点区间中存在就复用一下 BI.each(oldCh, function (index, child) { if (child && sameVnode(child, newStartVnode)) { updated = self.patchItem(sameOldVnode, newStartVnode, index, index) || updated; @@ -453,8 +453,8 @@ BI.Layout = BI.inherit(BI.Widget, { insertBefore(sameOldVnode, oldStartVnode); } }); - newStartVnode = newCh[++newStartIdx]; } + newStartVnode = newCh[++newStartIdx]; } } if (oldStartIdx > oldEndIdx) { @@ -486,7 +486,7 @@ BI.Layout = BI.inherit(BI.Widget, { function addNode (vnode, index) { var opt = self._getOptions(vnode); var key = opt.key == null ? index : opt.key; - return children[key] = self._addElement(key, vnode); + return children[key] = self._addElement(index, vnode); } function addVnodes (before, vnodes, startIdx, endIdx) { @@ -502,7 +502,7 @@ BI.Layout = BI.inherit(BI.Widget, { if (BI.isNotNull(ch)) { var node = self._getOptions(ch); var key = node.key == null ? startIdx : node.key; - delete self._children[self._getChildName(key)]; + delete self._children[self._getChildName(startIdx)]; children[key]._destroy(); } } diff --git a/template/index.html b/template/index.html index 3cd341242..213e71282 100644 --- a/template/index.html +++ b/template/index.html @@ -10,6 +10,8 @@ +
+