Skip to content

实践&建议 ​

节点 ​

节点尽量简单,不要有循环引用,否则可能存在死循环问题。

深拷贝 ​

YiuTree的深拷贝默认使用JSON.parse(JSON.stringify(treeData)),如果这不满足你的要求,你可以使用TreeBaseOpt.deepClone或TreeBaseOpt.deepCloneFunc进行修改。

禁用深拷贝 ​

js
const result = getFilterBySearch([], () => true, { deepClone: false });

替换深拷贝方法 ​

js
import { cloneDeep } from "lodash";

const result = getFilterBySearch([], () => true, { deepCloneFunc: cloneDeep });

Last updated:

Released under the MIT License.