提交 ca18e691 编写于 作者: 雪洛's avatar 雪洛

fix: canvas组件宽度或高度为0时报错的Bug(question/90647)

上级 882dc3f5
......@@ -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()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册