一维JSON转树结构
摘要:
const treeFormat = (arr: any) => { let map: any = {}; // 构建map // 构建以id为键 当前数据为值 arr.forEach((item: any) => { item["children"] = []; map[item['id']] = 阅读全文
posted @ 2022-09-02 17:18 Y_Shmily 阅读(87) 评论(0) 推荐(0) 编辑