// # 给定数组
const start = [
'.a',
'.a.1',
'.a.1.2',
'.a.1.3',
'.a.4',
'.a.5',
'.b.1',
'.b.2',
'.b.2.3',
]
// 最终解
const end = [
{
title: 'a',
children: [
{
title: '1',
children: [
{
title: '2',
},
{
title: '3',
}
],
},
{
title: '4',
},
{
title: '5',
},
]
},
{
title: 'b',
children: [
{
title: '1'
},
{
title: '2',
children: [
{
title: '3'
}
]
},
]
}
]
😁😁😁😁😁
全部评论
(0) 回帖