提交 d4958901 编写于 作者: 辛宝Otto's avatar 辛宝Otto 🥊

fix: canvas 测试消除控制台告警

上级 e212aa66
...@@ -94,12 +94,14 @@ ...@@ -94,12 +94,14 @@
id: 'canvas', id: 'canvas',
component: this, component: this,
success: (context : CanvasContext) => { success: (context : CanvasContext) => {
const canvasContext = context.getContext('2d')!;
const canvas = canvasContext.canvas;
if (this.canvasContext == null) { if (this.canvasContext == null) {
const canvasContext = context.getContext('2d')!;
this.canvasContext = canvasContext this.canvasContext = canvasContext
this.testCanvasContext = true this.testCanvasContext = true
const canvas = canvasContext.canvas;
hidpi(canvas); hidpi(canvas);
this.canvasWidth = canvas.width; this.canvasWidth = canvas.width;
this.canvasHeight = canvas.height; this.canvasHeight = canvas.height;
...@@ -107,7 +109,6 @@ ...@@ -107,7 +109,6 @@
} }
this.measureText() this.measureText()
const canvas = this.canvasContext.canvas
this.testToDataURLResult = canvas.toDataURL().startsWith('data:image/png;base64') this.testToDataURLResult = canvas.toDataURL().startsWith('data:image/png;base64')
this.canvas = canvas; this.canvas = canvas;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册