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类型的?
3 回复
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。