小程序Canvas生成圖片draw()出現黑屏問題/不完整,安卓機率大

在當前小程序版本中對於Canvas空間繪製圖片,存在bug,效率比較低。javascript

致使圖片回執完成慢。出現黑屏。java

解決方案:canvas

在調用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獲取自定義子組件this

相關文章
相關標籤/搜索