在canvas.draw回调内调用canvasToTempFilePath生成图片不完整?
ctx.draw(false, function() {
console.log(w, h, "canvasToTempFilePath")
setTimeout(function () {
wx.canvasToTempFilePath({
width: w,
height: h,
fileType: 'jpg',
canvasId: `bgcavas${bgId}`,
success: function (res) {
wx.getImageInfo({
src: res.tempFilePath,
success: info => {
console.log(info, "info")
}
})
that.setData({
bgImg: res.tempFilePath
});
},
complete: res => {
if (res.errMsg == 'canvasToTempFilePath:ok') {
that.setData({
bgImg: res.tempFilePath
})
} else {
console.error('cavas 绘制图片错误')
}
}
}, that)
}, 3000)
}); //开始绘制
这是cavas绘制的图片
使用api保存后的图片
1 回复
你好,请使用新的canvas实现:小程序新 Canvas 接口公测? - 微信开放社区 https://developers.weixin.qq.com/community/develop/doc/00020a02c2c040114d19a398f5b001