Home > @jview/utils > getTreeNodeByKey
getTreeNodeByKey() function
根据目标 key 值找到
Signature:
typescript
export declare function getTreeNodeByKey<K extends string = 'key', C extends string = 'children', T extends TreeNode<K, C> = TreeNode<K, C>>(nodes: T[], key: string | number, mapper: FieldMapper<K, C>): T | null;
export declare function getTreeNodeByKey<K extends string = 'key', C extends string = 'children', T extends TreeNode<K, C> = TreeNode<K, C>>(nodes: T[], key: string | number, mapper: FieldMapper<K, C>): T | null;
Parameters
Parameter | Type | Description |
---|---|---|
nodes | T[] | 节点数组 |
key | string | number | 目标 key 值 |
mapper | FieldMapper<K, C> | 字段映射,主要是映射 key 和 children 字段 |
Returns:
T | null