Closed Ucself closed 4 years ago
相关讨论 #40
drawQrcode({
width: 300-40, height: 300-40,
x: 20, y: 20,
canvasId: 'canvas',
background: '#ffffff',
foreground: '#000000',
text: "sample text",
callback(e) {
console.log('e: ', e)
//callback 回调不准确 #18
setTimeout(() => {
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: 300,
height: 300,
canvasId: 'canvas',
fileType: 'png',
success(res) {
console.log('图片的临时路径为:', res.tempFilePath)
let tempFilePath = res.tempFilePath
that.setData({
qrImgsrc: tempFilePath,
shareTips: "长按图片,直接分享给微信好友",
qrLoaded:true
})
}
})
}, 500)
}
})
Description
[问题简单描述]
Environment
Reproduce
问题复现步骤: 怎么将生成的二维码保存为本地图片。 期望的表现:
[在这里描述期望的表现]
怎么将生成的二维码保存为本地图片。
[在这里描述观察到的表现]
怎么将生成的二维码保存为本地图片。
![复现步骤的屏幕截图和动态 GIF 图](图片的 url)
Relevant Code / Logs