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.
如上代碼所示,調(diào)用context.draw()方法后褐墅,瀏覽器報錯信息立膛。
解決方法
setTimeout(function() {
context.draw(false, ()=> {
uni.canvasToTempFilePath({}, this)
})
}, 500)
App拍照后锻霎,輸出圖片顯示空白
在uniapp的文檔中录语,有這么一段說明信息: h5呈础、app-vue 中單個尺寸過大的 canvas 在 iOS/Safari 無法繪制(具體限制尺寸未公布)