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, 0, 0)
ctx.draw()
setTimeout(function(){
wx.canvasToTempFilePath({
x: 0,
y: 0,
canvas: 'myCanvas',
fileType: 'jpg',
success(res) {
console.log(res)
}
})
},500)
this.basicsSteps()
}