// 遍历二级对象数组,根据需求,提取自己想要的信息,组成新的数据格式
// 以下是遍历示例代码,可根据情况任意发挥
let newList = []
for (const item of list) {
let newObj = { name: item.name }
// 遍历数组1
for (const item1 of item.childrenList1) {
// 遍历数组2
for (const item2 of item1.childrenList2) {
newObj[item2.age] = item2.age
}
list.push(newObj)
this.newList = list
}
}
二级数组对象遍历 for..of
最新推荐文章于 2024-07-24 13:53:49 发布