首先下载js库
npm i arale-qrcode
在html中引入
<script type="text/javascript" src="js/qrcode.min.js"></script>
<div id="qrcode" ></div>
var qrcode = new QRCode(document.getElementById("qrcode"), {
text: "",//页面链接
width: 128,//生成二维码宽度
height: 128,//生成二维码高度
colorDark : "#000000",//前景色
colorLight : "#ffffff",// 背景色
});