Variables
findTree
constfindTree:FindTreeFunc
根据迭代器查找树列表子节点
Param
树列表
Param
迭代器
Param
配置项
Example
ts
findTree(
[
{
id: 1,
text: '1',
children: [
{
id: 3,
text: '3',
}
]
},
{
id: 2,
text: '2',
}
],
(node) => node.id >= 2,
)
// => { index: 0, node: { id: 3, text: '3', }, paths: ['0', 'children', '0'], nodes: [{ id: 1, text: '1', children: [{...}], }, { id: 3, text: '3', }], tree: [...] }Interfaces
FindResult<T>
Type Parameters
| Type Parameter |
|---|
T |
Properties
| Property | Type |
|---|---|
index | number |
node | T |
nodes | T[] |
parent? | T |
paths | string[] |
tree | T[] |
FindTreeOptions
Properties
| Property | Type | Description |
|---|---|---|
childrenKey? | string | 子节点键 Default 'children' |