Skip to content

toTreeArray

Functions

toTreeArray()

toTreeArray<T, DataKey, DropKeys>(array, options): ArrayItem<T, IfEmpty<DataKey, never, DataKey>, IfEmpty<DropKeys, never, DropKeys>>[]

将一个树结构列表转成数组列表

Type parameters

ParameterValue
T extends Object-
DataKey extends string | number | symbolnever
DropKeys extends stringnever

Parameters

ParameterTypeDescription
arrayT[]树结构数组列表
optionsToTreeArrayOptions<DataKey extends string ? DataKey : never, DropKeys>配置项

Returns

ArrayItem<T, IfEmpty<DataKey, never, DataKey>, IfEmpty<DropKeys, never, DropKeys>>[]

Interfaces

ToTreeArrayOptions<DataKey, DropKeys>

Type parameters

ParameterValue
DataKey extends stringnever
DropKeys extends stringnever

Properties

PropertyTypeDescription
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

ParameterValue
T extends ObjectObject
DataKey extends keyof Tnever
DropKeys extends stringnever