真机 image不显示canvasToTempFilePath转出来的图片
wx.getImageInfo({
src: imagePath,
success:function(res){
console.log("imgDetail-->imgSize:" + res.width + "*" + res.height);
self.setData({
canvasWidth: Number.parseFloat(res.width),
canvasHeight: Number.parseFloat(res.height),
})
var context = wx.createCanvasContext("first");
context.setFontSize(14)
for(var index in showData){
context.fillText(showData[index].words, showData[index].position.left, showData[index].position.top)
}
context.draw()
context.draw(false, function () {
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: res.width,
height: res.height,
destWidth: res.width * 2,
destHeight: res.height * 2,
quality: 1,
canvasId: 'first',
success(res) {
console.log('绘制结果'+JSON.stringify(res))
self.setData({
imagePath: res.tempFilePath,
})
}
})
});
}
})
麻烦使用新的接口试下:https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html
真机打开调试发现展示了?
https://developers.weixin.qq.com/community/develop/article/doc/000ac686c5c5506f18b87ee825b013
你不写代码片段 我们查看不到问题。