Tree: fix updateChildren

This commit is contained in:
Leopoldthecoder
2017-11-08 14:09:44 +08:00
committed by 杨奕
parent 363a80b184
commit 7f8991a664
3 changed files with 10 additions and 9 deletions

View File

@@ -198,9 +198,10 @@ export default class TreeStore {
const node = this.nodesMap[key];
if (!node) return;
const childNodes = node.childNodes;
childNodes.forEach(child => {
for (let i = childNodes.length - 1; i >= 0; i--) {
const child = childNodes[i];
this.remove(child.data);
});
}
for (let i = 0, j = data.length; i < j; i++) {
const child = data[i];
this.append(child, node.data);