qrcode toCanvas在生成二维码中间加上logo
解决方法:
import QRCode from 'qrcode'
var canvas = document.getElementById('canvas')
QRCode.toCanvas(canvas, qrUrl, {width: 281,margin:0},function (error) {
canvas.getContext('2d').drawImage($("#logoImg")[0],$(canvas).width()/2-25 , $(canvas).height()/2-25, 50, 50);
})
标签
<canvas id="canvas"></canvas>
<img id="logoImg" style="display: none;" />