Browse Source

Pull request #2102: 无JIAR任务 整理代码

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit 'd7a2198101270ea251022dcdb944ca727e2b5235':
  整理代码
  整理代码
es6
guy 3 years ago
parent
commit
b3172b2e56
  1. 6
      src/core/wrapper/layout.js

6
src/core/wrapper/layout.js

@ -441,7 +441,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} else { } else {
var sameOldVnode = findOldVnode(oldCh, newStartVnode, oldStartIdx, oldEndIdx); var sameOldVnode = findOldVnode(oldCh, newStartVnode, oldStartIdx, oldEndIdx);
if (BI.isNull(sameOldVnode)) { // 不存在就把新的放到左边 if (BI.isNull(sameOldVnode)) { // 不存在就把新的放到左边
var node = addNode(newStartVnode); var node = addNode(newStartVnode, newStartIdx);
insertBefore(node, oldStartVnode); insertBefore(node, oldStartVnode);
newStartVnode = newCh[++newStartIdx]; newStartVnode = newCh[++newStartIdx];
} else { // 如果新节点在就旧节点区间中存在就复用一下 } else { // 如果新节点在就旧节点区间中存在就复用一下
@ -486,7 +486,7 @@ BI.Layout = BI.inherit(BI.Widget, {
function addNode (vnode, index) { function addNode (vnode, index) {
var opt = self._getOptions(vnode); var opt = self._getOptions(vnode);
var key = opt.key == null ? index : opt.key; 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) { function addVnodes (before, vnodes, startIdx, endIdx) {
@ -502,7 +502,7 @@ BI.Layout = BI.inherit(BI.Widget, {
if (BI.isNotNull(ch)) { if (BI.isNotNull(ch)) {
var node = self._getOptions(ch); var node = self._getOptions(ch);
var key = node.key == null ? startIdx : node.key; var key = node.key == null ? startIdx : node.key;
delete self._children[self._getChildName(key)]; delete self._children[self._getChildName(startIdx)];
children[key]._destroy(); children[key]._destroy();
} }
} }

Loading…
Cancel
Save