const loop = tree =>
tree.map(item => {
if (item.children && item.children.length > 0) {
return { title: item.title, key: item.dataIndex, children: loop(item.children) }
}
return { title: item.title, key: item.dataIndex }
})
const list = loop ([
{
title: 'a',
name: 'a',
key:'a',
children: [
{
title: 'c',
name: 'c',
key:'c',
children: [
{ title: 'e', name: 'e',key:'e' },
{ title: 'f', name: 'f' ,key:'f'},
],
},
{ title: 'd', name: 'd',key:'d' },
{ title: 'e', name: 'e' ,key:'e'},
],
},
{ title: 'b', name: 'b' ,key:'b'},
])
console.log(list)
07-18
1115
11-18
1万+
06-07
1万+