Giter Site home page Giter Site logo

h5-scan's Introduction

h5-scan

移动端调用摄像头,扫描二维码(支持react和原生js) 封装jsQR,调用摄像头扫描或许二维码

兼容性

https://caniuse.com/#search=getUserMedia

使用说明

  1. git clone https://github.com/zyzcss/h5-scan.git
  2. cd h5-scan
  3. yarn & yarn start | npm install & npm run start
  4. 确保pc和手机再同一局域网下,使用ipconfig查看ipv4指向的ip 例:192.168.0.1 手机浏览器输入 react环境:https://192.168.0.1:3000/ 原生js环境:https://192.168.0.1:3000/test.html

React

使用方式

支持组件形式和函数形式

组件

import ScanCode from './ScanCode/ScanCode' <ScanCode {...config}/>

函数

import { show } from './ScanCode/ScanCode' show({ ...config })

参数

详见ScanCode/ScanCode.tsx内的ScanFuncProps

参数名 参数类型 参数说明
visible boolean 显示隐藏(函数调用时不用传)
onCancel Function 关闭回调
onOk Function 成功回调
multiple boolean 是否连续扫描

JS

使用说明

没有过多封装 实现了基础扫码功能 见public/test.html

h5-scan's People

Contributors

zyzcss avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.