123456789101112131415161718192021222324252627 |
- <html>
- <head>
- <title>Html-Qrcode Demo</title>
- <body>
- <div id="qr-reader" style="width:500px;"></div>
- <!-- <div id="qr-reader-results"></div> -->
- </body>
- <script src="./html5-qrcode.min.js"></script>
- <script>
- const html5QrCode = new Html5Qrcode("qr-reader");
- // decodedText: 0xd1acf1eb9c956d1e90b650dd56bed57a5df2fcae
- // decodedResult: decodedResult: {"decodedText":"0xd1acf1eb9c956d1e90b650dd56bed57a5df2fcae","result":{"text":"0xd1acf1eb9c956d1e90b650dd56bed57a5df2fcae","format":{"format":0,"formatName":"QR_CODE"}}}
- const qrCodeSuccessCallback = (decodedText, decodedResult) => {
- /* handle success */
- alert('decodedText: ' + decodedText);
- };
- const config = { fps: 10, qrbox: 300 };
- // If you want to prefer back camera
- html5QrCode.start({ facingMode: "environment" }, config, qrCodeSuccessCallback);
- html5QrcodeScanner.render(onScanSuccess);
- </script>
- </head>
- </html>
|