标签:https http list bsp const ret parent ref 方法
转,实测成功
https://segmentfault.com/a/1190000022444269
// 将同级数据转化为树形结构 listToTree(dataSource) { // datasource是平级的数据来源 return dataSource.filter(e => { const pid = e.parentId const resultArr = dataSource.filter(ele => { if (ele.menuId === pid) { if (!ele.children) { ele.children = [] } ele.children.push(e) return true } }) return resultArr.length === 0 }) },
标签:https http list bsp const ret parent ref 方法
原文地址:https://www.cnblogs.com/jane-panyiyun/p/13385462.html