G6.Util.traverseTreee 首次加载获取不到数据
- 执行2次 深度优先遍历树数据 才能拿到数据;
- 首次遍历
collapsed
属性拿不到;页面加载 - 第二次遍历
collapsed
属性有值;且已页面加载,不生效没有收起
G6.Util.traverseTree(this.treeData, (item) => {
if (item.depth && item.depth > 2) {
//collapsed为true时默认收起
item.collapsed = true;
}
});
this.graph.data(this.treeData);
this.graph.render();