收藏
回答

wx.canvasToTempFilePath在自定义组件中报错,在页面中直接使用是ok的。?

 // 生成图片
  getJpg(ctx, height){
    console.log('66666',ctx)
    ctx.draw(false,()=>{
      const wxCanvasToTempFilePath = utils.wxPromisify(wx.canvasToTempFilePath);
      wxCanvasToTempFilePath({
        canvasId: 'shareCanvas',
        fileType: 'jpg',
        quality: 1,
        height: height,
        success(res) {
          console.log(res.tempFilePath,'0000',res)
        },
        fail(res) {
          console.log(res.tempFilePath,'63444',res)
        },
      }).then(res=>{
        this.setData({
          imageSrc:res.tempFilePath
        })
        console.log(res.tempFilePath,'0000',res)
  
      })
      wx.hideLoading();
  
    },this)
    
  },
回答关注问题邀请回答
收藏

2 个回答

  • Demons
    Demons
    2022-06-09

    能提供一下报错吗

    2022-06-09
    有用
    回复
  • 武曲心
    武曲心
    2022-06-09

    报啥错?大家举手来猜?

    2022-06-09
    有用
    回复
登录 后发表内容