Canvas绘制图片无效
发布于 6 年前 作者 yonglong 7109 次浏览 来自 官方Issues

<canvas type=“2d” style=“width: 300; height: 200;” canvas-id=“firstCanvas”></canvas>

let ctx = wx.createCanvasContext(‘firstCanvas’)

wx.downloadFile({

url: https://www.baidu.com/img/bd_logo1.png,

success: res => {

console.log(res)

if (res.statusCode === 200) {

ctx.drawImage(res.tempFilePath, 10, 10, 150, 100)

ctx.draw()

}

}

})

回到顶部