Commit ba886e89 authored by 杨奕's avatar 杨奕 Committed by GitHub

Merge pull request #260 from furybean/master

Fix Tree: clear children when setData
parents cd7156cb 96587926
...@@ -75,6 +75,8 @@ export default class Node { ...@@ -75,6 +75,8 @@ export default class Node {
setData(data) { setData(data) {
this.data = data; this.data = data;
this.children = [];
let children; let children;
if (this.level === -1 && this.data instanceof Array) { if (this.level === -1 && this.data instanceof Array) {
children = this.data; children = this.data;
...@@ -231,6 +233,7 @@ export default class Node { ...@@ -231,6 +233,7 @@ export default class Node {
const resolve = (children) => { const resolve = (children) => {
this.loaded = true; this.loaded = true;
this.loading = false; this.loading = false;
this.children = [];
this.doCreateChildren(children, defaultProps); this.doCreateChildren(children, defaultProps);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment