v2.2.1
版本发布时间: 2022-04-07 21:45:37
mebjas/html5-qrcode最新发布版本:v2.3.8(2023-04-15 13:48:51)
Version 2.2.1 - version 2.2.3 (no code changes).
-
Added support for
supportedScanType
inHtml5QrcodeScanner
. This feature was implemented by our latest contributor - mohsinaav@Now users can decide to only use camera based scan or file based scan or use them in different order. How to use:
function onScanSuccess(decodedText, decodedResult) { // handle the scanned code as you like, for example: console.log(`Code matched = ${decodedText}`, decodedResult); } let config = { fps: 10, qrbox: {width: 100, height: 100}, rememberLastUsedCamera: true, // Only support camera scan type. supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA] }; let html5QrcodeScanner = new Html5QrcodeScanner( "reader", config, /* verbose= */ false); html5QrcodeScanner.render(onScanSuccess);
For file based scan only choose:
supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_FILE]
For supporting both as it is today, you can ignore this field or set as:
supportedScanTypes: [ Html5QrcodeScanType.SCAN_TYPE_CAMERA, Html5QrcodeScanType.SCAN_TYPE_FILE]
To set the file based scan as defult change the order:
supportedScanTypes: [ Html5QrcodeScanType.SCAN_TYPE_FILE, Html5QrcodeScanType.SCAN_TYPE_CAMERA]
1、 html5-qrcode.min.js 340.34KB