let that = this;
console.log(that.data.imgPath)
const ctx = wx.createCanvasContext(‘myCanvas’);
ctx.drawImage(that.data.imgPath, 0, 0, 150, 150);
ctx.draw(true, function () {
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: 150,
height: 150,
destWidth: 150,
destHeight: 150,
canvasId: ‘myCanvas’,
success: function (res) {
console.log(res.tempFilePath)
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success(res) {
console.log(res)
}, fail(res) {
console.log(res)
}
})
}, fail(res) {
console.log(‘canvasToTempFilePath’, res)
}
})
});
我也是遇到同样的问题,开发工具能显示图片,保存图片,到真机就不能显示图片到画布上面了__,that.data.imgPath 是图片base64内容, 要是正常图片路径就可以显示,base64真机显示不了到画布, 我的手机机型是 小米6,微信版本6.7.2__