小程序
上传多张图片完成后,返回来多条图片真实路径数据,我将它们用JSON.parse转换好了之后。。。。就开始懵了,不懂怎么把它们全部都再转为数组。。。本人基础很差,被赶鸭子上架
请问各位大佬如何将多条返回来的数据转为数组。。。。
uploadBtn: function() {
let that = this
wx.chooseImage({
count: 9,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
that.setData({
uploadlist: res.tempFilePaths
})
let tempFilePaths = res.tempFilePaths
for (var i = 0; i < tempFilePaths.length; i++) {
wx.uploadFile({
url: app.globalData.api + 'Justice/upload' + app.globalData.key,
filePath: tempFilePaths[i],
name: 'file',
header: {
'content-type': 'multipart/form-data'
},
formData: {
token: wx.getStorageSync('token'),
village_id: wx.getStorageSync('village_id'),
gov_id: wx.getStorageSync('gov_id'),
},
success(res) {
let returnPATH = res.data
console.log(JSON.parse(returnPATH))
}
})
}
}
})
},
下面是两张是转换前和转后返回的数据