weapp qrcode base64
1.0.0
Generating the QR code in the form of Base64
A plug-in for WeChat applet to generate QR codes. It outputs QR codes based on base64 encoding and does not rely on canvas. It supports all platforms in theory.
PS: Mainly based on the
node-yaqrcode
project, it is adapted to the WeChat applet.
Just add an image
tag to the wxml file to dynamically reference the base64 encoding.
<image src="{{qrcodeURL}"> </image>
Using NPM
npm install qrcode-base64
JS call example:
import QR from 'qrcode-base64'
var imgData = QR.drawImg(this.data.codeText, {
typeNumber: 4,
errorCorrectLevel: 'M',
size: 500
})
// 返回输出base64编码imgData
JS call example:
const QR = require('../../utils/weapp-qrcode.js')
var imgData = QR.drawImg(this.data.codeText, {
typeNumber: 4,
errorCorrectLevel: 'M',
size: 500
})
// 返回输出base64编码imgData
mpvue
, wepy