The image argument is a canvas element with a width or height of 0
Error in event handler for "service.7-canvas-007u28vk5kh8p": "InvalidStateError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0."
DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
如上代码所示,调用context.draw()方法后,浏览器报错信息。
解决方法
setTimeout(function() {
context.draw(false, ()=> {
uni.canvasToTempFilePath({}, this)
})
}, 500)
App拍照后,输出图片显示空白
在uniapp的文档中,有这么一段说明信息: h5、app-vue 中单个尺寸过大的 canvas 在 iOS/Safari 无法绘制(具体限制尺寸未公布)