All Projects → yingye → Weapp Qrcode

yingye / Weapp Qrcode

Licence: mit
weapp.qrcode.js 在 微信小程序 中,快速生成二维码

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Weapp Qrcode

Weapp Qrcode Base64
微信小程序生成二维码的插件,基于base64编码输出二维码,不依赖canvas
Stars: ✭ 100 (-91.62%)
Mutual labels:  qrcode, wechat, weapp
Supermarketmini
基于wepy2.x 仿苏宁小店小程序,API采用go开发(已开源),项目正在开发中,欢迎加群:160301726
Stars: ✭ 73 (-93.89%)
Mutual labels:  wechat-mini-program, wechat, wepy
We Cropper
微信小程序图片裁剪工具
Stars: ✭ 1,972 (+65.16%)
Mutual labels:  wechat, weapp, wepy
Wxapp Boilerplate
使用 webpack, babel, scss 开发的微信/支付宝小程序项目脚手架
Stars: ✭ 367 (-69.26%)
Mutual labels:  wechat-mini-program, wechat, weapp
Wepy Mall
微信小程序--基于wepy 商城(微店)微信小程序 欢迎学习交流
Stars: ✭ 3,224 (+170.02%)
Mutual labels:  wechat-mini-program, wechat, wepy
We Validator
💯 简单灵活的表单验证插件,支持小程序、浏览器以及Nodejs端使用
Stars: ✭ 180 (-84.92%)
Mutual labels:  wechat-mini-program, wechat, weapp
Masterwechatapp
『微信小程序』优秀教程、轮子、开源项目 资源汇总
Stars: ✭ 826 (-30.82%)
Mutual labels:  wechat-mini-program, wechat, weapp
Wxapp Webpack Plugin
📦 微信小程序 webpack 插件
Stars: ✭ 185 (-84.51%)
Mutual labels:  wechat-mini-program, wechat, weapp
Weapp Qrcode
Wechat miniapp generate qrcode image
Stars: ✭ 339 (-71.61%)
Mutual labels:  qrcode, wechat, weapp
Tina
💃 一款轻巧的渐进式微信小程序框架
Stars: ✭ 1,153 (-3.43%)
Mutual labels:  wechat-mini-program, wechat, weapp
Taro scaffold
基于 Taro / dva / redux-saga / react 的微信小程序脚手架,同时集成了 sprite 。
Stars: ✭ 24 (-97.99%)
Mutual labels:  wechat-mini-program, wechat
Moui
🍕面向现代浏览器的 CSS 样式库
Stars: ✭ 21 (-98.24%)
Mutual labels:  wechat-mini-program, wechat
Image Cropper
💯一款功能强大的微信小程序图片裁剪插件
Stars: ✭ 893 (-25.21%)
Mutual labels:  wechat, wepy
Alaweb
一套 Vue 代码,多端可用(H5、小程序、苹果App、安卓App、头条等)。系统含150+页面,200+组件(5端通用),30+元件(每个终端独立完成)
Stars: ✭ 837 (-29.9%)
Mutual labels:  wechat-mini-program, weapp
Xiaochengxu demos
小程序优秀项目源码汇总,每个项目都有图有源码,零基础学微信小程序,小程序表格,小程序视频,小程序视频弹幕,小程序仿天猫大转盘抽奖等源码,小程序云开发,小程序发邮件,小程序支付,微信支付,持续更新。。。
Stars: ✭ 855 (-28.39%)
Mutual labels:  wechat, weapp
Leshare Shop Wepy
基于微信小程序的在线商城,采用wepy框架开发
Stars: ✭ 839 (-29.73%)
Mutual labels:  weapp, wepy
Taro
开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
Stars: ✭ 30,230 (+2431.83%)
Mutual labels:  wechat-mini-program, wechat
Anka Tracker
Miniprogram user behavior tracking library. Supports task queues, automatically suspended and retry strategies.
Stars: ✭ 29 (-97.57%)
Mutual labels:  wechat-mini-program, wechat
Mpvue Animated Number
微信小程序 mpvue 数字更新滚动动画组件 / An animated number component for mpvue
Stars: ✭ 33 (-97.24%)
Mutual labels:  wechat-mini-program, wechat
Nideadmin
【未完成】NideAdmin - 基于 Vue.js + Egg.js 的微信小程序后台框架
Stars: ✭ 35 (-97.07%)
Mutual labels:  wechat-mini-program, weapp

weapp-qrcode

npm version change-log

weapp.qrcode.js 在 微信小程序 中,快速生成二维码

Usage

先在 wxml 文件中,创建绘制的 canvas,并定义好 width, height, canvasId

<canvas style="width: 200px; height: 200px;" canvas-id="myQrcode"></canvas>

直接引入 js 文件,使用 drawQrcode() 绘制二维码。!!!在 调用 drawQrcode() 方法之前,一定要确保可以获取到 canvas context

在 v0.6.0 版本构建出多个文件,详情移步Build Files说明

// 将 dist 目录下,weapp.qrcode.esm.js 复制到项目目录中
import drawQrcode from '../../utils/weapp.qrcode.esm.js'

drawQrcode({
  width: 200,
  height: 200,
  canvasId: 'myQrcode',
  // ctx: wx.createCanvasContext('myQrcode'),
  text: 'https://github.com/yingye',
  // v1.0.0+版本支持在二维码上绘制图片
  image: {
    imageResource: '../../images/icon.png',
    dx: 70,
    dy: 70,
    dWidth: 60,
    dHeight: 60
  }
})

如果项目使用了 wepy 框架,可直接安装 weapp-qrcode npm包。

npm install weapp-qrcode --save
import drawQrcode from 'weapp-qrcode'

drawQrcode({
  width: 200,
  height: 200,
  canvasId: 'myQrcode',
  text: 'https://github.com/yingye'
})

DEMO

更多 demo 可以参考 examples目录,示例包含原生语法及WePY、mpvue、Taro框架。

API

drawQrcode([options])

options

Type: Object

参数 说明 示例
width 必须,二维码宽度,与canvaswidth保持一致 200
height 必须,二维码高度,与canvasheight保持一致 200
canvasId 非必须,绘制的canvasId 'myQrcode'
ctx 非必须,绘图上下文,可通过 wx.createCanvasContext('canvasId') 获取,v1.0.0+版本支持 'wx.createCanvasContext('canvasId')'
text 必须,二维码内容 'https://github.com/yingye'
typeNumber 非必须,二维码的计算模式,默认值-1 8
correctLevel 非必须,二维码纠错级别,默认值为高级,取值:{ L: 1, M: 0, Q: 3, H: 2 } 1
background 非必须,二维码背景颜色,默认值白色 '#ffffff'
foreground 非必须,二维码前景色,默认值黑色 '#000000'
_this 非必须,若在组件中使用,需要传入,v0.7.0+版本支持 this
callback 非必须,绘制完成后的回调函数,v0.8.0+版本支持。安卓手机兼容性问题,可通过自行设置计时器来解决,更多可以参考 issue #18 function (e) { console.log('e', e) }
x 非必须,二维码绘制的 x 轴起始位置,默认值0,v1.0.0+版本支持 100
y 非必须,二维码绘制的 y 轴起始位置,默认值0,v1.0.0+版本支持 100
image 非必须,在 canvas 上绘制图片,层级高于二维码,v1.0.0+版本支持,更多可参考drawImage { imageResource: '', dx: 0, dy: 0, dWidth: 100, dHeight: 100 }

位置信息可以参见下图:

TIPS

weapp.qrcode.js 二维码生成部分借鉴了 jquery-qrcode 源码,可以参考 jquery-qrcode

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].