wx.canvasToTempFilePath 无效,也不报错,有知道是什么原因的吗?
wx.canvasToTempFilePath 方法根本运行不了 只打印出开始了跟走过了 有没有大佬解答下
createQrCode: function (url, canvasId, cavW, cavH) {
//调用插件中的draw方法,绘制二维码图片
QR.api.draw(url, canvasId, cavW, cavH);
setTimeout(() => { this.canvasToTempImage(); }, 2000);
},
canvasToTempImage: function () {
console.log('开始了');
wx.canvasToTempFilePath({
canvasId: 'mycanvas',
success: function (res) {
console.log(res);
var tempFilePath = res.tempFilePath;
console.log(tempFilePath);
this.setData({
imagePath: tempFilePath,
});
},
fail: function (res) {
console.log('错误');
console.log(res);
}
});
console.log('走过了');
},