这是我用uni写的,有问题可以联系我zkhh666
wx.canvasToTempFilePath({
x: 100,
y: 200,
width: 50,
height: 50,
destWidth: 100,
destHeight: 100,
canvasId: 'myQrcode',
success(res) {
console.log('QrCode-74',res)
console.log(res.tempFilePath)
wx.saveImageToPhotosAlbum({ //保存图片到相册
filePath: res.tempFilePath,
success: function () {
wx.showToast({
title: "保存图片成功!",
duration: 2000
})
}
})
},
fail(err) {
console.log(err)
}
},this)