<canvas wx:show="{{false}}" type="2d" id="canvasForHardwarePrint"></canvas>
script:
getCanvasPrint () {
return new Promise((resolve, reject) => {
const query = wx.createSelectorQuery()
query.select('#canvasForHardwarePrint').fields({ node: true, size: true }).exec((res) => {
const canvas = res[0].node
const ctx = canvas.getContext('2d')
const dpr = wx.getSystemInfoSync().pixelRatio
canvas.width = res[0].width * dpr
canvas.height = res[0].height * dpr
ctx.scale(dpr, dpr)
ctx.fillRect(0, 0, 1, 1)
let imageData = ctx.createImageData(1, 1)
const base64 = wx.arrayBufferToBase64(imageData.data)
resolve(hashCode(base64))
})
})
}
我这边没有wx:show的设置,回调也没有调用
wx:show="{{false}}"去掉这个看下?