Article directory
introduce
QRCode.js is a JavaScript library for generating QR codes. It is mainly obtained by obtaining DOM tags, and then
drawn through HTML5 Canvas, without relying on any library.
Basic usage of qrcode
<div id="qrcode"></div>
<script type="text/javascript">
new QRCode(document.getElementById("qrcode"), "http://jindo.dev.naver.com/collie");
</script>
Or
qrcdoe.toDataUrl needs to pass a string, this function executes and returns a Promise
let imgUrl = await qrcode.toDataURL(this.payInfo.codeUrl)
Generate QR code parameters
var qrcode = new QRCode("test", {
text: "http://www.runoob.com",
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
operate
qrcode.clear(); 清除
qrcode.makeCode("http://naver.com"); 再次生成