chooseImg(e) {
console.log("选择的图片", e)
let index = e.currentTarget.dataset.index; //外层wx:for的下标 resumeLicensesNameFullList的下标;
let indexImg = e.currentTarget.dataset.childindex; //图片的下标resumeLicensesPathFullList的下标;
let resumeLicensesNameFullList = this.data.resumeLicensesNameFullList;
let item = 'resumeLicensesNameFullList['+index+'].resumeLicensesPathFullList['+indexImg+'].filePath';
console.log("itemImg", item)
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sizeType: ['original', 'compressed'], //普通还是压缩
sourceType: ['album', 'camera'],
maxDuration: 0,
camera: 'back',
success: (res) => {
console.log(res)
this.setData({
[item]: res.tempFiles[0].tempFilePath,
})
}
})
},
数据结构
resumeLicensesNameFullList: [{
"licenseName": "",
"resumeLicensesPathFullList": [{
"filePath": "/images/hdpi/upload.jpg"
}, {
"filePath": "/images/hdpi/upload.jpg"
}]
},{
"licenseName": "",
"resumeLicensesPathFullList": [{
"filePath": "/images/hdpi/upload.jpg"
}, {
"filePath": "/images/hdpi/upload.jpg"
}]
}],