上传图片函数
clickimage: function(e) {
var index = e.currentTarget.dataset.index;
var count = 4;
var that = this;
wx.chooseImage({
count: count,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success(res) {
var tempFilePaths = res.tempFilePaths;
for (var x = 0; x < res.tempFilePaths.length; x++) {
wx.getFileSystemManager().readFile({
filePath: res.tempFilePaths[x], //选择图片返回的相对路径
encoding: "base64",//这个是很重要的
success: res => { //成功的回调
//返回base64格式
console.log('data:image/png;base64,' + res.data)
}
})
}
}
})
},