大佬们,问一下原生小程序上传图片,如果newData = dataDict[1] 为什么只能把type为5的传上去,后面那一组就传不上去了。最后一张图是后端要的数据格式 uploadImg (fileList,fileList1,fileList2,fileList3) { // 定义一个对象字典,存储不同的数据 const dataDict = { 0: { Pics: [ { type: 1, pic: fileList }, { type: 2, pic: fileList1 }, { type: 3, pic: fileList2 }, { type: 4, pic: fileList3 } ] }, 1: { Pics: [ { type: 5, pic: fileList }, { type: 6, pic: fileList1 } ] }, }; const newData = dataDict[this.data.ofIndex] || { Pics: [] }; const data = newData; let UpUrl; var config =(wx.getStorageSync('config')); if (this.data.ofIndex == 0 || this.data.ofIndex == 1 || this.data.ofIndex == 2 || this.data.ofIndex == 3) { UpUrl = config.host+'/api/GL/AddXMGLSectionInf'; console.log("121",UpUrl); } else if (this.data.ofIndex == 4 || this.data.ofIndex == 5) { UpUrl = config.host+'/api/GL/AddXMGLSectionInfFireHydrantValvePitMap'; } data.Pics.forEach((picObj, picIndex) => { return picObj.pic.forEach((picItem, index) => { console.log("picObj---->",picObj); let formData = { [`Pics[${picIndex}].type`]: picObj.type, 'ProjectNo': this.data.projectsNumber, 'ProjectName': this.data.projectsName, 'Source': this.data.Source, 'ProjectType': 2 }; wx.uploadFile({ url: UpUrl, filePath: picItem.url, name: `Pics[${picIndex}].Pic`, formData: formData, success(res) { console.log("上传成功", res); // 上传成功后的处理逻辑 } }); }); }); }, 我尝试过把 [`Pics[${picIndex}].type`]: picObj.type, 改为`Pics[${Index}].type`]: picObj.type, name: `Pics[${picIndex}].Pic`,改为name: `Pics[${Index}].Pic`,这样只能传每组的第一张,后面几张就传不上去了。希望大佬可以帮我解决