微信小程序的数据处理方式
forEach
let photoListGroup = []
this.data.vehicleList.forEach(item => {
item.photoUrl.forEach(itemP => {
photoListGroup.push({
photoUrl: itemP.imgPath,
locationDamage: item.locationDamage
})
})
})
map
this.cardNumArr = []
this.cardNumArr.push(this.addedListL[index]);
this.increased = this.cardNumArr.map(item => {
return {
remark: item.remark, //备注
unJianStr: item.xunJianStr,
resulttitle: item.resulttitle,
};
});
map
let ifT = 0;//用于判断每个点检项是否都提交保存了,0为所有都提交了
this.processedGuntao =this.positinspect.map(item => {
if(!item.checkUserId){
ifT++
}
return {
...item, //其他内容原数返回
filePath: item.filePath ? item.filePath.split(',') : [], // 分割filePath为数组
reformFile: item.reformFile ? item.reformFile.split(',') :[] // 分割reformFile为数组
};
});