drawImage' on 'CanvasRenderingContext2D?
发布于 7 年前 作者 jingwan 10798 次浏览 来自 官方Issues

Failed to execute ‘drawImage’ on ‘CanvasRenderingContext2D’: The provided value is not of type ‘(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)’

TypeError: Failed to execute ‘drawImage’ on ‘CanvasRenderingContext2D’: The provided value is not of type ‘(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)’

就是把一张图写入画布,然后把画布导出,百度了案例,怎么弄都不成功,社区的各位老师帮忙看看呀。

const ctx = wx.createCanvasContext('myCanvas')
          ctx.drawImage(imgs, 00)
          ctx.draw()
          setTimeout(function(){
              wx.canvasToTempFilePath({
                x0,
                y0,
                canvas'myCanvas',
                fileType'jpg',
                success(res) {
                  console.log(res)
                }
              })
          },500)
          this.basicsSteps()
        }
回到顶部