toTreeArray
Functions
toTreeArray()
toTreeArray<
T
,DataKey
,DropKeys
>(array
,options
):ArrayItem
<T
,IfEmpty
<DataKey
,never
,DataKey
>,IfEmpty
<DropKeys
,never
,DropKeys
>>[]
将一个树结构列表转成数组列表
Type parameters
Parameter | Value |
---|---|
T extends Object | - |
DataKey extends string | number | symbol | never |
DropKeys extends string | never |
Parameters
Parameter | Type | Description |
---|---|---|
array | T [] | 树结构数组列表 |
options | ToTreeArrayOptions <DataKey extends string ? DataKey : never , DropKeys > | 配置项 |
Returns
ArrayItem
<T
, IfEmpty
<DataKey
, never
, DataKey
>, IfEmpty
<DropKeys
, never
, DropKeys
>>[]
Interfaces
ToTreeArrayOptions<DataKey, DropKeys>
Type parameters
Parameter | Value |
---|---|
DataKey extends string | never |
DropKeys extends string | never |
Properties
Property | Type | Description |
---|---|---|
childrenKey? | string | 子节点键 Default 'children' |
dataKey? | DataKey | 数据存放键 |
dropKeys? | DropKeys [] | 需要放弃的键,设置后将会移除对应键,例如节点上的 children 或其他。 |
Type Aliases
ArrayItem<T, DataKey, DropKeys>
ArrayItem<
T
,DataKey
,DropKeys
>:ArrayItemWithDropKeys
<ArrayItemBase
<T
,DataKey
>,DropKeys
>
Type parameters
Parameter | Value |
---|---|
T extends Object | Object |
DataKey extends keyof T | never |
DropKeys extends string | never |