const getChild=(arr)=>{
const newArr = []
for(let item = 0;item < arr.length;item++){
newArr.push(arr[item].props.value)
if(arr[item].props.children.length>0){
newArr.push(...getChild(arr[item].props.children))
}
}
return newArr
}
递归拍平数组
最新推荐文章于 2023-11-10 22:41:46 发布