wx.canvasGetImageData 无法获取象素
https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasGetImageData.html
wx.canvasGetImageData({
canvasId: 'canvasBox',
x: 0,
y: 0,
width: 100,
height: 100,
success(res) {
console.log(res.width) // 100
console.log(res.height) // 100
console.log(res.data instanceof Uint8ClampedArray) // true
console.log(res.data.length) // 100 * 100 * 4
},
complete(res) { console.log( res ) }
})
{errMsg: “canvasGetImageData: fail canvas is empty”} api不生效
3 回复