數(shù)據(jù)children不定,js單獨函數(shù)處理數(shù)據(jù),如同將 name變更為tile,value變更為key,如果children數(shù)組為空,則輸出isLeaf:true,否則,繼續(xù)循環(huán)變更子項求解...數(shù)據(jù)結(jié)構(gòu)如下list = [
{
name: '0', value: '0',
children: [
name: '0-1', value: '0-1',
children: [
name: '0-2', value: '0-2',
children: [ // ...
], // ...
]
]
},
];
js N多層(不定)嵌套循環(huán)變更json中key值方法輸出完整的新的list對象
肥皂起泡泡
2019-01-24 11:02:26