const list = [{id: 100,name: 100, pid: 10}, {id: 20, name: 20, pid: 2}, {id: 1, name: 1}, {id: 2, name: 2}, {id: 10, name: 10, pid: 1}, {id: 11, name:[......]
使用递归将一维数组转换为树型结构
Leave a reply
const list = [{id: 100,name: 100, pid: 10}, {id: 20, name: 20, pid: 2}, {id: 1, name: 1}, {id: 2, name: 2}, {id: 10, name: 10, pid: 1}, {id: 11, name:[......]