canvasToTempFilePath:fail:create bitmap failed
saveImgToLocal() {
const that = this;
setTimeout(() => {
wx.canvasToTempFilePath({
canvasId: 'k-canvas',
destWidth: that.canvasWidthInPx,
destHeight: that.canvasHeightInPx,
success: function (res) {
that.getImageInfo(res.tempFilePath);
},
fail: function (error) {
console.error(`canvasToTempFilePath failed, ${JSON.stringify(error)}`);
that.triggerEvent('imgErr', {
error: error
});
const { errMsg } = error
if(errMsg === 'canvasToTempFilePath:fail:create bitmap failed') {
that.errorCount += 1;
if (that.errorCount < 3) {
that.saveImgToLocal();
} else {
// 错了这么多遍基本没救了
that.$u.toast('手机性能不够,绘制失败')
}
}
},
}, this);
}, 300);
}
微信小程序运行这段代码,华为p10 绘制失败,出现 canvasToTempFilePath:fail:create bitmap failed,延迟和重新调用都没用。 各位前端大神有办法吗?