狼烟蛮蛮
狼烟蛮蛮
  • 发布:2020-12-10 18:16
  • 更新:2020-12-10 18:16
  • 阅读:1219

canvas绘制图片空白

分类:uni-app

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绘制图片之后还是空白

2020-12-10 18:16 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复