Variables
mapTree
const
mapTree:MapTreeFunc
根据迭代器映射子节点生成新的树列表
Param
树列表
Param
迭代器
Param
配置项
Example
ts
mapTree(
[
{
id: 1,
text: '1',
children: [
{
id: 3,
text: '3',
}
]
},
{
id: 2,
text: '2',
}
],
(node) => {
if (node.id === 2) {
node.text = '22'
}
return node
},
)
// => [{...}, { id: 2, text: '22', }]
Interfaces
MapTreeOptions<ChildrenKey, MappingChildrenKey>
Type Parameters
Type Parameter | Default type |
---|---|
ChildrenKey extends string | string |
MappingChildrenKey extends string | never |
Properties
Property | Type | Description |
---|---|---|
childrenKey? | ChildrenKey | 子节点键 Default 'children' |
mapChildrenKey? | MappingChildrenKey | 映射后的子节点键,设置后则必定存在于节点上 |