fix: add vconsole for mobile debug

This commit is contained in:
yugasun
2020-01-16 12:38:06 +08:00
parent 0996ab57ad
commit dfccc2f09a
5 changed files with 70 additions and 42 deletions
+12 -6
View File
@@ -1,6 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>QrcodeDecoder - Camera</title>
</head>
<body>
@@ -9,22 +12,25 @@
<hr />
<video id="video" autoplay></video>
<script src="./lib/vconsole.min.js"></script>
<script src="./index.aio.min.js"></script>
<script type="text/javascript">
var vConsole = new VConsole();
console.log("Hello world");
function main() {
var qr = new QrcodeDecoder();
var video = document.querySelector('#video');
var start = document.querySelector('#start');
var stop = document.querySelector('#stop');
var result = document.querySelector('#result');
var video = document.querySelector("#video");
var start = document.querySelector("#start");
var stop = document.querySelector("#stop");
var result = document.querySelector("#result");
async function startScan() {
if (!qr.isCanvasSupported()) {
alert("Your browser doesn't match the required specs.");
throw new Error('Canvas and getUserMedia are required');
throw new Error("Canvas and getUserMedia are required");
}
let code = await qr.decodeFromCamera(video);
console.log('code', code);
console.log("code", code);
result.innerText = "Result: " + code.data;
}
start.onclick = startScan;