摘要: /** * 树转数组扁平化结构 * 深度优先遍历 堆栈 后进先出 */ function deep(node){ let stack = node, data = []; while(stack.length != 0){ let pop = stack.pop(); data.push({ id: 阅读全文
posted @ 2021-08-20 14:25 SaBoo 阅读(799) 评论(0) 推荐(0) 编辑
摘要: let arr =[ {id:2,name:'部门1',parentId:0}, {id:3,name:'部门2',parentId:1}, {id:1,name:'部门3',parentId:2}, {id:4,name:'部门4',parentId:1}, {id:5,name:'部门5',pa 阅读全文
posted @ 2021-08-20 14:24 SaBoo 阅读(445) 评论(0) 推荐(0) 编辑