iphonex 使用createSelectorQuery 获取canvas节点 报错?
attached() {
const dpr = wx.getSystemInfoSync().pixelRatio
const query = wx.createSelectorQuery().in(this)
this.dpr = dpr
query.select('#canvas')
.fields({node: true, size: true})
.exec(res => {
console.log(res,",,,,,,,,,,,,,,,,,,");
const canvas = res[0].node
const ctx = canvas.getContext('2d')
canvas.width = res[0].width * dpr
canvas.height = res[0].height * dpr
ctx.scale(dpr, dpr)
this.ctx = ctx
this.canvas = canvas
})
}