setTimeout(() => {
context.draw(true,()=>{
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: 340,
height: 500,
destWidth: 680,
destHeight: 1000,
canvasId: 'share',
success: function (res) {
console.log(res.tempFilePath)
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: (res) => {
console.log(res)
that.setData({
showModal: false
})
wx.hideToast({
complete: (res) => {},
fail: (res) => {},
success: (res) => {},
})
},
fail: (err) => {
console.log(err)
that.setData({
showModal: false
})
wx.hideToast({
complete: (res) => {},
fail: (res) => {},
success: (res) => {},
})
}
})
},
fail: function (e) {
console.log(e)
}
})
});
}, 1000);
},
这是运行代码 在开发工具上面能导出图片但是在真实手机上面就运行不起来