html部分:
<canvas canvas-id="poster_imgc" style='width:750px;height:1334px;'></canvas>
savehaibaoimg (img) {
var ctx = uni.createCanvasContext('poster_imgc'),that=this;
ctx.rect(0, 0, 750, 1334);
ctx.setFillStyle('#FF123F');
ctx.fill();
ctx.drawImage('/static/yuandan/haibaox.png', 0, 0, 750, 1334);
ctx.stroke();
ctx.draw(true, (setTimeout(function() {
that.huizhi();
}, 1000)));
},
huizhi () {
var that=this;
uni.canvasToTempFilePath({
canvasId: 'poster_imgc',
success: function(res) {
console.log(res.tempFilePath);
that.poster_url=res.tempFilePath
},
})
}
我没觉得哪里写错了,但是canvas绘制图片之后还是空白