xlfsummer / mp-painter

声明式地创建适用于 uniapp, 原生微信小程序和原生H5的 canvas 海报

Home Page:https://mp-painter.xlf-summer.cn/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

生成的图片和文字显示模糊 不够清晰 base64的图片在真机上不能显示 uniapp真机显示空白

chengzibutian opened this issue · comments

问题描述

//部分代码

function getImage() {
        let type = 'normal'
        let painter = new Painter(uni.createCanvasContext("canvas"));
        painter.draw({
          type: "container",
        
          children: [ 
          //二维码为base64
             { type: "image",
              top: -185,
              width:150,
              height:150,
              left:410,
              src:this.qr_code
            },
            {type: "text",fontSize: 18,left:420,top: 20,color: '#c5c5c5',content:'购买'}

          ]
        })
        let that = this
        setTimeout(function () {
          uni.canvasToTempFilePath({
            canvasId: 'canvas',
            destWidth:600,
            deatHeight:1200,
            success: function (res) {
              uni.hideLoading()
              that.canvasPosterCardBase64 = res.tempFilePath
            },
            fail: function (res) {
              console.log(res);
            }
          });
        }, 3000);

期望的结果

答:希望图片和文字能够清晰一点以及base64显示的问题用的环境

是微信、支付宝、还是其它的?
是在开发者工具中还是真机上?
答:微信小程序 真机显示 版本 "mp-painter": "^0.2.7"