fff: function () {
var that = this;
const ctx = wx.createCanvasContext('myCanvas')
wx.chooseImage({
success: function (res) {
ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
ctx.draw(false, () => {
wx.canvasGetImageData({
canvasId: 'myCanvas',
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) // 100 * 100 * 4
let base64 = wx.arrayBufferToBase64(res.data);
//console.log(base64)
that.data.userImageBase64 = 'data:image/jpg;base64,' + base64;
console.log(that.data.userImageBase64)
}
})
})
}
})
},
小程序开发后台显示如图
但是这最后一大窜码转换不出正确的图片,求大神指导。。。
这个问题解决了吗!!!!!