Skip to content

Home > sculp-js > formatTree

formatTree() function

扁平化数组转换成树

Signature:

typescript
export declare function formatTree(list: any[], options?: IFieldOptions): any[];

Parameters

Parameter

Type

Description

list

any[]

options

IFieldOptions

(Optional) 定制id字段名,子元素字段名,父元素字段名,默认 { keyField: 'key', childField: 'children', pidField: 'pid' }

Returns:

any[]

{any[]}

Released under the MIT License.