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

@styleofpicasso/qrcode

v0.0.4

Published

二维码的生成,二维码的解析

Downloads

10

Readme

@styleofpicasso/qrcode

qrcode 二维码解析器/二维码生成 的插件

how to install

For JQuery and original js

Download js lib from npmjs

npm i @styleofpicasso/qrcode

add js to html

<script type="text/javascript" src="/qrcode.min.js"></script>

For TypeScript such as Angular Vue React

install

npm i @styleofpicasso/qrcode --save-dev

Import

import * as QRCode from '@styleofpicasso/qrcode';

QRCode 说明

  • QRCode 支持本地图片的二维码解析, 二维码生成 / 带 logo 的二维码的生成 / 二维码的清除 / 二维码大小的设置 / 二维码的设置

QRCode

初始化生成二维码

QRcode.initCode(id, config);
id

生成二维码的容器 id

config 初始化配置信息
// 默认配置 (已经添加过的配置信息)
{
  // 二维码的默认配置
  width: 128,
  height: 128,
  colorDark: '#000',
  colorLight: '#fff',
  correctLevel: QRCode.CorrectLevel.H,
  dotScale: 1,

  // 二维码的生成工具(canvas 或 svg) 默认 canvas
  drawer: 'canvas'
}

// 必须添加的配置
{
  // 初始生成二维码的内容
  text: ''
}

// 可以添加的配置
{
  // 二维码logo的配置信息
  logo: undefined,
  logoWidth: undefined,
  logoHeight: undefined,
  logoBackgroundColor: '#fff',
  logoBackgroundTransparent: false,

  // 二维码背景的配置信息
  backgroundImage: '', // Background Image
  backgroundImageAlpha: 1, // Background image transparency, value between 0 and 1. default is 1.
  autoColor: false,

  // 二维码标题的配置信息
  title: 'QR Title', // content
  titleFont: "bold 18px Arial", // font. default is "bold 16px Arial"
  titleColor: "#004284", // color. default is "#000"
  titleBackgroundColor: "#fff", // background color. default is "#fff"
  titleHeight: 70, // height, including subTitle. default is 0
  titleTop: 25 // d

  // 二维码副标题的配置信息
  subTitle: 'QR subTitle', // content
  subTitleFont: "14px Arial", // font. default is "14px Arial"
  subTitleColor: "#004284", // color. default is "4F4F4F"
  subTitleTop: 40 // draws y coordinates. default is 0

  // 二维码的事件配置
  onRenderingStart: undefined,
  onRenderingEnd: undefined,
}

根据内容再次生成二维码

QRCode.makeCode(text);
text

生成二维码的内容

二维码的清楚功能

/**
 * 清除二维码
 */
QRCode.clearCode();

设置二维码的宽高

/**
 * 二维码的大小调整
 * width : 宽
 * height: 高
 */
QRCode.resizeCode(width, height)

二维码的解析 (图片二维码的解析 / 这里不涉及扫码等功能)

/**
 * 图片二维码的解析功能
 * file 本地选择的图片文件; 或 有效图片的路径
 * callback  解析成功之后的回调函数, 参数: 解析的内容 当解析失败时,返回undefine, 成功返回解析数据
 */
QRCode.deCode(file, callback);

CHANGE LOG

V0.0.2

添加 readme 的使用说明

v0.0.1

创建@styleofpicasso/qrcode