diff --git a/src/core/view/components/canvas/index.vue b/src/core/view/components/canvas/index.vue index 740b09859e2ef5bd2493aac75f783128c1b6b444..5113f14067f89122757dd80e2e7a317d9d6be89d 100644 --- a/src/core/view/components/canvas/index.vue +++ b/src/core/view/components/canvas/index.vue @@ -123,10 +123,14 @@ export default { }, _resize () { var canvas = this.$refs.canvas - var context = canvas.getContext('2d') - var imageData = context.getImageData(0, 0, canvas.width, canvas.height) - wrapper(this.$refs.canvas) - context.putImageData(imageData, 0, 0) + if (canvas.width > 0 && canvas.height > 0) { + var context = canvas.getContext('2d') + var imageData = context.getImageData(0, 0, canvas.width, canvas.height) + wrapper(this.$refs.canvas) + context.putImageData(imageData, 0, 0) + } else { + wrapper(this.$refs.canvas) + } }, _touchmove (event) { event.preventDefault()