1. 安裝包
cnpm i qrcodejs2 -S
2、使用
<div class="codeImg" style="width:1.45rem;height:1.45rem;margin:.15rem auto" id="qrCode"></div>
// 引入 import QRCode from 'qrcodejs2' methods: { let qrcode = new QRCode("qrCode", { width: 150, height: 150, // 高度 text: `${location.origin}${location.pathname}/#/?inviteUid=${this.curUser.userId}`, //要生成二維碼的鏈接(或當前頁面地址) colorDark : "#000", colorLight : "#fff", }); },
