From 3a07fa353f200d35b5c441c2ec1ab46a46b60d62 Mon Sep 17 00:00:00 2001 From: hdx Date: Mon, 25 Nov 2024 17:37:45 +0800 Subject: [PATCH] =?UTF-8?q?createCanvasContextAsync:=20=E5=9C=A8=E7=94=9F?= =?UTF-8?q?=E5=91=BD=E5=91=A8=E6=9C=9F=20onLoad=20=E4=B8=AD=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=EF=BC=8C=E9=85=8D=E5=90=88=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 32b846c46952ff78b6936675094accb0164c2112) --- pages/component/canvas/canvas.uvue | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pages/component/canvas/canvas.uvue b/pages/component/canvas/canvas.uvue index 19dd3d06..71d8abe3 100644 --- a/pages/component/canvas/canvas.uvue +++ b/pages/component/canvas/canvas.uvue @@ -76,7 +76,7 @@ testFrameCount: 0 } }, - onReady() { + onLoad() { // HBuilderX 4.25+ // 异步调用方式, 跨平台写法 uni.createCanvasContextAsync({ @@ -100,14 +100,15 @@ this.testCanvasContext = true } }) - - // 同步调用方式,仅支持 app/web - // let canvas = uni.getElementById("canvas") as UniCanvasElement - // this.renderingContext = canvas.getContext("2d") - // hidpi(canvas); - // this.canvas = canvas; - // this.canvasWidth = canvas.width; - // this.canvasHeight = canvas.height; + }, + onReady() { + // 同步调用方式,仅支持 app/web + // let canvas = uni.getElementById("canvas") as UniCanvasElement + // this.renderingContext = canvas.getContext("2d") + // hidpi(canvas); + // this.canvas = canvas; + // this.canvasWidth = canvas.width; + // this.canvasHeight = canvas.height; }, onUnload() { if (this.taskId > 0) { -- GitLab