需求是將扁平化的數(shù)組轉(zhuǎn)成樹形結(jié)構(gòu),比如:consta=[[1,2,3],['a','b','c'],['A','B','C']];constres=[];要求a數(shù)組轉(zhuǎn)化成res是這個樣子:[{label:'1',children:[{label:'a',children:[{label:'A'}]}]},{label:'2',children:[{label:'b',children:[{label:'B'}]}]},{label:'3',children:[{label:'c',children:[{label:'C'}]}]},]
json數(shù)據(jù)轉(zhuǎn)換,扁平化數(shù)組轉(zhuǎn)為樹形結(jié)構(gòu)?求指點
回首憶惘然
2019-05-24 10:21:26