提交 ce0cf57b 编写于 作者: H hdx

create-canvas-context-async: 处理编译警告问题

上级 87aed3d2
......@@ -376,14 +376,14 @@
pattern() {
const context = this.canvasContext!
this.image = new Image(100, 100)
this.image!.src = '../../../static/api.png';
const image = new Image(100, 100)
image.src = '../../../static/api.png';
// Only use the image after it's loaded
this.image!.onload = () => {
image!.onload = () => {
context.save()
context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)
const pattern = context.createPattern(this.image!, "repeat")
// context.fillStyle = pattern
const pattern = context.createPattern(image!, "repeat")
context.fillStyle = pattern
context.fillRect(0, 0, 100, 100)
context.restore()
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册