function *** (){
const allData = []
const loop = (data = []) => {
data.forEach(it => {
if (it.children?.length) {
loop(it.children)
}
allData.push({
...it,
})
})
}
loop(item.children)
}