Skip to content

当节点属性过多时,使用懒加载加载大数据量时,smoothTree方法会内存溢出 #59

@wodehaochide

Description

@wodehaochide

1、节点属性多并且节点个数多时
Image
会报内存溢出的问题
Image

是smooth方法中reduce导致的,改成下面这种效果可能要好一点。
smoothTree(treeData, array) {
for (const data of treeData) {
if (data.visible) {
// Mark different types to avoid being optimized out when assembled into the same dom
data.type = this.showCheckbox
? ${data.level}-${data.checked}-${data.indeterminate}
: ${data.level}-${data.expanded};
array.push(data);
}
if (data.expanded && data.childNodes.length) {
this.smoothTree(data.childNodes, array)
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions