1 //data爲須要修改的tree,這裏主要是爲antd design 裏面select規範數據 2 const ass = (data) => { 3 let item = []; 4 data.map((list, i) => { 5 let newData = {}; 6 newData.key= list.id; 7 newData.value = list.id; 8 newData.title = list.name; 9 newData.children = list.children ? ass(children) : []; //若是還有子集,就再次調用本身 10 item.push(newData); 11 }); 12 return item; 13 }