uni——将一个数组的属性赋值到另一个数组中(交换)

案例介绍

现有两个数组A 、B,最终想要得到C样式的数组。
在这里插入图片描述

案例代码

首先将A数组遍历循环,拿到索引index,然后赋值

this.cardList.forEach((item,index)=>{
    
    
	this.cardList[index]['num'] = this.arr[index]
})

猜你喜欢

转载自blog.csdn.net/xulihua_75/article/details/129799917