wx.getImageInfo({
src: imgUrl,
success (tempImage) {
query
.select('#myCanvas')
.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, canvas.width, canvas.height)
console.log('image-temp-path', tempImage.path)
ctx.drawImage(tempImage.path, 0, 0, 300, 300)
});
},
fail (err) {
console.error('err from getImageInfo', err)
}
})
你好,麻烦提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。