onReady: function () {
console.log('onReady')
let that = this;
wx.canvasToTempFilePath({
canvasId: 'qrcode',
success: function (res) {
that.setData({shareImg: res.tempFilePath})
},
fail: function (res) {
wx.showToast({title: '图片生成失败'});
console.log("图片生成失败error", res)
}
},that)
},
电脑上没问题,手机上就会显示canvasToTempFilePath: fail canvas is empty",求大佬指点!
参考一下看看用canvasToTempFilePath,老是报错fail canvas is empty?? 💡 的回答 - 微信开放社区 https://developers.weixin.qq.com/community/develop/doc/000c6460ed09c056062b2555a5b000?_at=1642326038930&jumpto=comment&commentid=00042a3aab8e707f0a2b80f6f5b0