Fix Tree: clear children when setData

pull/260/head
furybean 2016-10-08 14:49:53 +08:00
parent cd7156cb03
commit 96587926a9
1 changed files with 3 additions and 0 deletions

View File

@ -75,6 +75,8 @@ export default class Node {
setData(data) {
this.data = data;
this.children = [];
let children;
if (this.level === -1 && this.data instanceof Array) {
children = this.data;
@ -231,6 +233,7 @@ export default class Node {
const resolve = (children) => {
this.loaded = true;
this.loading = false;
this.children = [];
this.doCreateChildren(children, defaultProps);