转树
js数组和树互转
js数组和树互转1. 数组转树const arr = [{id:1, parentId: null, name: 'a'},{id:2, parentId: null, name: 'b'},{id:3, parentId: 1, name: 'c'},{id:4, parentId: 2, name: 'd'},{id:5, parentId: 1, name: 'e'},{id:6, pare...
js数组和树互转1. 数组转树const arr = [{id:1, parentId: null, name: 'a'},{id:2, parentId: null, name: 'b'},{id:3, parentId: 1, name: 'c'},{id:4, parentId: 2, name: 'd'},{id:5, parentId: 1, name: 'e'},{id:6, pare...