我的数据数组
data:[
0:{
id:1 ,.....
competetion:[
0:{
id: 1....,
match:[
0:{id: 1 ......},
1:{same}
.
.
]
1:{same}]},
2:{same}
.
.
]
},
1:{same},
2:{same}
.
.
.
]
对于data[]
,我能够通过推入元素来创建一个新的数组(sportarr[]
),但我希望在同一个数组sportarr[]
中为competetion[]
和match[]
也创建相同的数组。
如果有其他方法,请帮助我...
我的代码:我正在循环它:
this.sportsSidebar = response.data; // My data Array (this.sportsSidebar)
const arrlength = response.data.length;
for (let i = 0; i < arrlength; i++) {
this.sportarr.push({ // I declared a new array where i want to push the element
id: i,
value: false
});
}