直接贴代码
weChQrcode(params).then(res => {
var qrCode = res.data //后台返回的base64图片流
wx.getFileSystemManager().writeFile({
filePath: wx.env.USER_DATA_PATH + "/test.png",
data: qrCode,
encoding: 'base64',
success: (res) => {
that.setData({
qrCode: wx.env.USER_DATA_PATH + "/test.png" //绘制图片使用的图片路径
})
}
})
})