wx.chooseImage({
success (res) {
const tempFilePaths = res.tempFilePaths
wx.uploadFile({
url: 'https://example.weixin.qq.com/upload', //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'file',
formData: {
'user': 'test'
},
success (res){
var data = JSON.parse(res.data);
//此处应该如此转换后才可以用setData赋值,否则setData失效报错
var thimg = data.msg;
that.setData({
comimg: thimg
})
}
})
}
})