let one = [];
let two = [];
let AllMes = [];
this.pileInformation.forEach( (item, index) => {
if(index%2){
two.push(item)
} else {
one.push(item)
}
})
one.forEach( (item, index) => {
AllMes.push([item,two[index]])
})
this.$set(this,'AllDate',AllMes)


本文介绍了一种通过遍历数组实现元素配对的方法。首先将原始数组分成两个子数组,然后将这两个子数组的对应元素组合成新的数组对。这种方法可用于数据整理和展示等场景。

876

被折叠的 条评论
为什么被折叠?



