Merge pull request #260 from furybean/master

Fix Tree: clear children when setData
This commit is contained in:
杨奕 2016-10-08 15:04:31 +08:00 committed by GitHub
commit ba886e8904

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);