diff --git a/pages/API/create-canvas-context-async/create-canvas-context-async.uvue b/pages/API/create-canvas-context-async/create-canvas-context-async.uvue index ec6c30f8b81ef552ed82bdbb3be6e8cef75b9935..7c9829a76636bc9e4b46aa483672b75130574310 100644 --- a/pages/API/create-canvas-context-async/create-canvas-context-async.uvue +++ b/pages/API/create-canvas-context-async/create-canvas-context-async.uvue @@ -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() };