uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function(res) {
console.log(res)
that.headportrait = res.tempFilePaths[0]
wx.getFileSystemManager().readFile({
filePath: res.tempFilePaths[0],
encoding: 'base64',
success: response => {
let base64 = 'data:image/png;base64,' + response.data
console.log(base64)
}
})
}
});
uni-app 获取图片base64
最新推荐文章于 2024-01-14 15:17:00 发布
关键词由CSDN通过智能技术生成