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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wines/qrcode

v2.0.0

Published

The qrcode @wines

Readme

@wines/qrcode

Qrcode 二维码

用于展现二维码。

使用指南

在 page.json 中引入组件

{
  "navigationBarTitleText": "wux-qrcode",
  "usingComponents": {
    "wux-qrcode": "@wines/qrcode"
  }
}

示例

<view class="page">
	<view class="page__hd">
		<view class="page__title">Qrcode</view>
		<view class="page__desc">二维码</view>
	</view>
	<view class="page__bd">
		<view class="sub-title">请输入文字,即时输入即时生成</view>
		<wux-cell-group>
			<wux-cell hover-class="none">
				<wux-textarea
				 hasCount
				 rows="3"
				 placeholder="支持文本、网址和电子邮箱"
				 maxlength="300"
				 value="{{ value }}"
				 controlled
				 bind:change="onChange"
				/>
			</wux-cell>
		</wux-cell-group>
		<view class="sub-title">提示:Canvas 在微信中无法长按识别, 点击图片进入保存页面长按图片可以保存</view>
		<view class="qrcode">
			<wux-qrcode
			 id="wux-qrcode"
       padding="{{ 20 }}"
			 data="{{ value }}"
			 fg-color="{{ fgColor }}"
			 width="200"
			 height="200"
			 bind:click="previewImage"
			/>
		</view>
	</view>
</view>
import './index.less';
import { $wuxQrcode } from '@wines/qrcode';

Page({
  data: {
    value: 'https://github.com/wux-weapp/wux-weapp',
    fgColor: 'black',
  },
  onChange(e) {
    const value = e.detail.value;
    const fgColor = this.randomColor();

    this.setData({
      value,
      fgColor,
    });
  },
  previewImage() {
    // 在自定义组件下,当前组件实例的 this,以操作组件内 <canvas> 组件
    const qrcode = $wuxQrcode('#wux-qrcode');
    wx.canvasToTempFilePath(
      {
        // Cavans `2d` 需要传入canvas实例, 不需要canvasId (要传canvas实例,就是你获取的res[0].node)
        canvas: qrcode.getCanvas(),
        width: 200,
        height: 200,
        destWidth: 300,
        destHeight: 300,
        success: (res) => {
          void wx.previewImage({
            urls: [res.tempFilePath],
          });
        },
      },
      qrcode
    );
  },
  randomColor() {
    const colorStr = Math.floor(Math.random() * 0xffffff)
      .toString(16)
      .toUpperCase();
    const length = colorStr.length;
    const prefixStr = '000000'.substring(0, 6 - length);
    return `#${prefixStr}${colorStr}`;
  },
});

API

Qrcode props

| 参数 | 类型 | 描述 | 默认值 | | ----------------- | ---------- | ----------------- | ------ | | data | string | 文本内容 | - | | typeNumber | number | 类型 | -1 | | errorCorrectLevel | number | 误差校正等级 | 2 | | width | number | canvas 组件的宽度 | 200 | | height | number | canvas 组件的高度 | 200 | | fgColor | string | 前景色 | black | | bgColor | string | 背景色 | white | | borderPadding | number | 边框填充距离 | 15 | | borderSize | number | 边框粗细 | 2 | | borderColor | string | 边框线颜色 | white | | bind:click | function | 点击事件 | - |