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

z-wx-qrcode

v1.0.0

Published

微信小程序二维码生成

Downloads

10

Readme

微信小程序二维码生成

使用

复制src/qrcode.js到小程序目录下,直接引入即可使用

方法说明

// 通过RenderingContext绘制
function draw(ctx: any, options: any):void

// 根据id绘制 一般使用这个
function drawById(id: any, options: any):void

// 参数说明
/*
* @param ctx canvas RenderingContext实例,通过canvas.getContext('2d')返回
* @param id string "qrCode" cavans_id
* @param options object 选项
* @param options.text string  二维码内容
* @param options.width number 二维码的宽度
* @param options.height number 二维码高度
* @param options.correctLevel number 错误校正级别 级别越高 整体需要携带的信息越多:1可纠正约7%错误、0可纠正约15%错误、3可纠正约25%错误、2级别可纠正约30%错误。
默认为2
* @param options.background string color-string 背景颜色 默认白色"#ffffff"
* @param options.image object 二维码中加入图片
* @param options.image.x number 图片在canvas中的x轴坐标
* @param options.image.y number 图片在canvas中的y轴坐标
* @param options.image.width number 图片宽度 px
* @param options.image.height number 图片高度 px
* @param options.image.url string 图片地址 支持远程图片地址、本地图片地址、临时文件地址
*/


示例

  1. 普通绘制

wxml

<canvas style="width:128px;height:128px" type="2d" id="qrCode"></canvas>

js

import {drawById} from "../tools/qrcode"
drawById.call(wx,"qrCode",{
    text:"1233"  , // 二维码内容
})

示意图

图片

代码片段

地址

  1. 控制二维码大小 wxml
<canvas style="width:128px;height:128px" type="2d" id="qrCode"></canvas>

js

import {drawById} from "../tools/qrcode"
drawById.call(wx,"qrCode",{
    text:"1233"  , // 二维码内容
    width:50,     // 宽度 px内容自动转换像素比
    height:50,    // 高度 
})

示意图

图片

代码片段

地址

  1. 加上图片 wxml
<canvas style="width:128px;height:128px" type="2d" id="qrCode"></canvas>

js

import {drawById} from "../tools/qrcode"
drawById.call(wx,"qrCode",{
      text:"1233",
      image:{
        url:"/images/money.png", // 支持远程图片、本地图片、临时图片
        width: 81, // 图片宽度
        height:93  // 图片高度
      }
})

示意图

图片

代码片段

地址

觉得好用的点个star吧( ̄▽ ̄)"