|
|
@@ -114,41 +114,6 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
|
|
|
- var onScanSuccess = (decodedText, decodedResult) => {
|
|
|
- // handle the scanned code as you like, for example:
|
|
|
- console.log(`Code matched = ${decodedText}`, decodedResult);
|
|
|
- this.scannerText = decodedText;
|
|
|
- }
|
|
|
-
|
|
|
- function onScanFailure(error) {
|
|
|
- // handle scan failure, usually better to ignore and keep scanning.
|
|
|
- // for example:
|
|
|
- console.warn(`Code scan error = ${error}`);
|
|
|
- }
|
|
|
-
|
|
|
- let html5QrcodeScanner = new Html5QrcodeScanner(
|
|
|
- "reader",
|
|
|
- { fps: 30, qrbox: { width: 500, height: 500 } },
|
|
|
- /* verbose= */ false);
|
|
|
- html5QrcodeScanner.render(onScanSuccess, onScanFailure);
|
|
|
- // This method will trigger user permissions
|
|
|
- Html5Qrcode.getCameras().then(devices => {
|
|
|
- /**
|
|
|
- * devices would be an array of objects of type:
|
|
|
- * { id: "id", label: "label" }
|
|
|
- */
|
|
|
- if (devices && devices.length) {
|
|
|
- var cameraId = devices[0].id;
|
|
|
- // .. use this to start scanning.
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- // handle err
|
|
|
- });
|
|
|
- // html5QrCode.stop().then((ignore) => {
|
|
|
- // // QR Code scanning is stopped.
|
|
|
- // }).catch((err) => {
|
|
|
- // // Stop failed, handle it.
|
|
|
- // });
|
|
|
}
|
|
|
}
|
|
|
|