https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/wx.uploadFile.html
回調(diào)函數(shù)返回?cái)?shù)據(jù)為string型,因此我們需要轉(zhuǎn)換成JSON
語法:var json= JSON.parse(String)
示例:
wx.uploadFile({
url: url,
filePath: path,
name: 'file',
header: {
header
},
formData: {
data
},
success: function(e) {
var json= JSON.parse(e.data) // 此處轉(zhuǎn)換
console.log(json)
},
complete: function(e) {
console.log(e)
}
})
發(fā)表評論