在当前小程序版本中对于Canvas空间绘制图片,存在bug,效率比较低。
导致图片回执完成慢。出现黑屏。
解决方案:
在调用draw(),绘制成功后,延迟使用绘制结果。例如:500毫秒后,输出图片内容。
ctx.draw(false, function () { console.info('绘制成功'); setTimeout(function () { wx.canvasToTempFilePath({ canvasId: 'canvas1', fileType: 'jpg', quality: 1, success: res => { console.info(res); _this.setData({ imgPath: res.tempFilePath }); }, fail: res => { console.error(res); } }, this); },3000); });
更多:
js时间函数getTime() 在苹果手机上返回NaN的问题
微信小程序swiper滑块视图容器控件使用整理
微信小程序selectComponent获取自定义子组件
小程序














