ZVIT

导航

2016年12月13日 #

将扁平的数据结构转换成层级的数据结构

摘要: 因为项目需求,有时候需要把扁平的数据结构变成通过id, pid联结起来的层叠数据结构,因此写了这个函数。 原始格式: [ {id: 'node1',pid: 'root',content: 'test'}, {id: 'node2',pid: 'root',content: 'test'}, {id 阅读全文

posted @ 2016-12-13 16:23 ZVIT 阅读(850) 评论(0) 推荐(0) 编辑