微信小游戏里并没有wx.createSelectorQuery()方法可以使用
window.getComputedStyle在微信中是否可用?我使用这个方法获取,出现错误: TypeError: window.getComputedStyle is not a function at wrapText (render.js? [sm]:19) at ScreenCont.renderText (screencont.js? [sm]:63) at ScreenCont.render (screencont.js? [sm]:55) at GameScene.render (gamescene.js? [sm]:86) at Main.render (main.js? [sm]:125) at Main.loop (main.js? [sm]:170) at VM2202 WAGameSubContext.js:1 at Function.cbWithTimeStamp (gamePage.html:58) at p (VM2186 WAGame.js:1) at VM2186 WAGame.js:1
01-10请问最后是怎么解决的呢
CanvasRenderingContext2D is not defined?CanvasRenderingContext2D.prototype.clear = function() { .... } 时遇到该问题,但我看通过以下代码: const query = wx.createSelectorQuery() query.select('#myCanvas') .fields({ node: true, size: true }) .exec((res) => { const canvas = res[0].node this.canvas = canvas; const ctx = canvas.getContext('2d') ... } 获取到的ctx 对象就是CanvasRenderingContext2D类型的?
01-10