npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@quansitech/react-qrscanner

v1.2.0

Published

## install npm i @quansitech/react-qrscanner

Downloads

8

Readme

summary

install

npm i @quansitech/react-qrscanner

usage

import React from 'react';
import ReactDOM from 'react-dom';
import  { QrcodeScanner, Util } from "@quansitech/react-qrscanner";

let defaultOpt = {
    websocket: 'ws://192.168.31.222:2346', //必填 websocket地址
    url: 'http://www.test.com/home/index/scan',  //二维码的地址,会自动在后面附上token 必填
    queryStr: 'project_id=1', //根据业务需要可在这里附加必须的参数 选填
    size: 128, //二维码的大小 选填 默认128
    bgColor: '#FFFF44', //二维码背景颜色 选填
    fgColor: '#CC00FF', //二维码前景色 选填
    imageSettings: {  //设置二维码中间图片 选填
        src: "https://cdn.learnku.com/uploads/images/201901/24/1/OyBnfB2vlk.png!/both/44x44", //图片的url地址
        height: 30, //图片高度
        width:30, //图片宽度
        excavate: true //是否挖孔
    },
    scannedRenderText: "已扫描", //扫描后展示的文字 选填 默认“已绑定”
    scannedRender: true, //是否使用扫描后自带的提示 选填 默认true
    scannedCallback:function(){ //扫描后执行的回调 选填
        let span = document.createElement('span');
        span.innerText = '测试';
        document.getElementById('1234').appendChild(span);
    }
};
ReactDOM.render(<QrcodeScanner url={defaultOpt.url} websocket={defaultOpt.websocket} 
    queryStr={defaultOpt.queryStr} size={defaultOpt.size} scannedRenderText={defaultOpt.scannedRenderText}
    bgColor={defaultOpt.bgColor} fgColor={defaultOpt.fgColor} imageSettings={defaultOpt.imageSettings}
    scannedCallback={defaultOpt.scannedCallback} scannedRender={defaultOpt.scannedRender} />, 
    document.getElementById("1234"));




//扫码调用
const util = new Util();

let psn = "ws://192.168.31.222:2346";  //websocket地址
let token = "####-####-####"; //二维码生成的token
let callback = function(status, error){   //扫码回调 status = 1表示扫码成功  0表示二维码失效  error返回错误信息
    if(status == 1){
        alert('success');
    }
    else{
        alert(error);
    }
}
let param = { custom_id: '1234567' } //需要传递给后端业务代码处理的参数
util.scan(psn, token, callback, param);