Converted sample project into an almost working Svelte / Meteor project. Needs to fix the login/logout code, the camera code, and add Chromebook history when the QR Code is scanned.
This commit is contained in:
41
imports/ui/ChromebookScan.svelte
Normal file
41
imports/ui/ChromebookScan.svelte
Normal file
@@ -0,0 +1,41 @@
|
||||
<style>
|
||||
.error {
|
||||
color: darkred;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import {Html5QrcodeScanner} from "html5-qrcode";
|
||||
|
||||
function onScanSuccess(decodedText, decodedResult) {
|
||||
console.log('Code matched ' + decodedResult);
|
||||
document.getElementById("log").prepend(decodedText);
|
||||
}
|
||||
|
||||
function onScanFailure(error) {
|
||||
}
|
||||
|
||||
function scanner() {
|
||||
let html5QrcodeScanner = new Html5QrcodeScanner("reader", {
|
||||
fps: 10,
|
||||
qrbox: {width: 250, height: 250}
|
||||
}, /* verbose */ false);
|
||||
|
||||
html5QrcodeScanner.render(onScanSuccess, onScanFailure);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div className="container">
|
||||
<div class="row">
|
||||
Hello World!
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div use:scanner id="reader" width="300px"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div id="log" class="col-12">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user