Skip to content

KBE3D / KBCore / utils / listToTree

函数: listToTree()

listToTree<T>(list: any[], config?: Partial<TreeMappingConfig>): T[]

集合转成树结构数据

类型参数

T

T = any

参数

list

any[]

目标集合

config?

Partial<TreeMappingConfig> = {}

配置项

返回

T[]

树结构数据

备注

ts
 DEFAULT_CONFIG: TreeMappingConfig = {
   id: 'id',
   children: 'children',
   pid: 'pid'
 }

KBE3D @3.0.0 Copyright © 2024-present KBE3D