提交 3a07fa35 编写于 作者: H hdx 提交者: 辛宝Otto

createCanvasContextAsync: 在生命周期 onLoad 中获取,配合自动化测试

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