已知原有数据 :
var data=[
{ id: 40, parentId: 31, note: "的萨达是" },
{ id: 20, parentId: 11, note: "的萨达是" },
{ id: 22, parentId: 20, note: "dsadas" },
{ id: 12, parentId: null, note: "dsadasad萨达s" },
{ id: 11, parentId: undefined, note: "dqwds" },
{ id: 24, parentId: 22, note: "搜索" },
{ id: 34, parentId: 22, note: "搜索" }
]
需要考虑的问题 :
a的parentId为b, b的parentId为a
发挥你的大脑, 来个最优解
PIPIONE
相关分类