wechat-miniapp-qrcode
Dynamically generated QR codes for Wechat Miniapps.
Notice: This library is only compatible with the WeChat mini program framework as it uses the WeChat native APIs.
If you are looking for the QR code generator for modern browsers, you may refer to lrsjng/kjua.
Requirements
- Mini program base library version >= 2.9.0
Usage
<canvas type="2d" id="myCanvas"></canvas>
import genQrcode from 'wechat-miniapp-qrcode'
const query = wx.createSelectorQuery()
query.select('#myCanvas')
.fields({ node: true, size: true })
.exec((res) => {
genQrcode(res[0].node, {text: 'Hello'})
})
The available options and their default values are:
{
render: 'canvas',
crisp: true,
minVersion: 1,
ecLevel: 'L',
size: 200,
ratio: null,
fill: '#333',
back: '#fff',
text: 'no text',
rounded: 0,
quiet: 0,
mode: 'plain',
mSize: 30,
mPosX: 50,
mPosY: 50,
label: 'no label',
fontname: 'sans',
fontcolor: '#333',
image: null
}
Dependencies
Acknowledgement
wechat-miniapp-qrcode is modified based on lrsjng/kjua (MIT), which is suitable for generating QR codes for modern browsers.
LICENSE
MIT
Trademark
QR Code is a registered trademark of DENSO WAVE INCORPORATED.