buttonHandler() {
var that = this
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function(res) {
console.log(res)
var tempFilePaths = res.tempFilePaths
// that.setData({
// image_src: tempFilePaths
// })
that.tempFilePath = tempFilePaths
wx.uploadFile({
complete(res){
console.log(res)
},
url: 'http://127.0.0.1:5000/test',
filePath: tempFilePaths[0],
name: 'test',
fail: function(res){
wx.showToast({
title: '失败',
duration: 1000
})
},
success: function (res) {
console.log(res)
var datas = JSON.parse(res.data.replace(/'/g, '"'))
console.log(datas)
that.setData({
image_src: datas.data.url
})
that.image_src = datas.data.url
}
})
}
})
},
瞎搞
拿小程序和web做比较是啥意思?还有这url是认真的?
不知道