使用 HTML、CSS 和 JavaScript 结合调用手机摄像头的API(如getUserMedia)以及条形码识别的 JavaScript 库(例如 QuaggaJS)来完成。 以下代码: <! video.style.width = '100%'; document.getElementById('barcodeScanner').appendChild(video); // 使用QuaggaJS }); </script> <script src="https://cdn.jsdelivr.net/npm/quagga"></script> </body> </html> 有网络连接,以加载 QuaggaJS
github.com/Automattic/node-canvas for more information 项目主页: https://github.com/lindell/JsBarcode quaggaJS quaggaJS是由H5实现的JavaScript扫码库,能将条形码扫描成文字,支持静态图片和视频流的扫描。 Ready to start"); Quagga.start(); }); 项目主页 https://github.com/serratus/quaggaJS ---- 往期精选文章