V2.0.8
版本发布时间: 2021-06-13 13:28:18
mebjas/html5-qrcode最新发布版本:v2.3.8(2023-04-15 13:48:51)
Version 2.0.8
- Added support for configuring supported formats in
Html5Qrcode
&Html5QrcodeScanner
.
Example usage:
Only scanning with QR code - using Html5Qrcode
const html5QrCode = new Html5Qrcode(
"reader", { formatsToSupport: [ Html5QrcodeSupportedFormats.QR_CODE ] });
const qrCodeSuccessCallback = message => { /* handle success */ }
const config = { fps: 10, qrbox: 250 };
// If you want to prefer front camera
html5QrCode.start({ facingMode: "user" }, config, qrCodeSuccessCallback);
Scanning with QR code and bunch of UPC codes - using Html5QrcodeScanner
function onScanSuccess(qrMessage) {
// handle the scanned code as you like, for example:
console.log(`QR matched = ${qrMessage}`);
}
const formatsToSupport = [
Html5QrcodeSupportedFormats.QR_CODE,
Html5QrcodeSupportedFormats.UPC_A,
Html5QrcodeSupportedFormats.UPC_E,
Html5QrcodeSupportedFormats.UPC_EAN_EXTENSION,
];
const html5QrcodeScanner = new Html5QrcodeScanner(
"reader",
{ fps: 10, qrbox: 250, formatsToSupport: formatsToSupport },
/* verbose= */ false);
html5QrcodeScanner.render(onScanSuccess);
By default scanning with all formats supported today
function onScanSuccess(qrMessage) {
// handle the scanned code as you like, for example:
console.log(`QR matched = ${qrMessage}`);
}
const html5QrcodeScanner = new Html5QrcodeScanner(
"reader", { fps: 10, qrbox: 250 }, /* verbose= */ false);
html5QrcodeScanner.render(onScanSuccess);
- Feature request: https://github.com/mebjas/html5-qrcode/issues/177
- Pull request: https://github.com/mebjas/html5-qrcode/pull/222
1、 html5-qrcode.min.js 316.21KB