Coder Social home page Coder Social logo

weapp-qrcode-base64's Introduction

weapp-qrcode

Generating the QR code in the form of Base64
微信小程序生成二维码的插件,基于base64编码输出二维码,不依赖canvas 理论支持全平台

PS: 主要在node-yaqrcode项目基础上进行改造适应微信小程序

说明

只需要在 wxml 文件中增加个image标签动态引用base64编码即可

<image src="{{qrcodeURL}"> </image>

使用NPM

npm install qrcode-base64

JS调用例子:

    import QR from 'qrcode-base64'

    var imgData = QR.drawImg(this.data.codeText, {
      typeNumber: 4,
      errorCorrectLevel: 'M',
      size: 500
    })
    // 返回输出base64编码imgData

JS调用例子:

    const QR = require('../../utils/weapp-qrcode.js')
    var imgData = QR.drawImg(this.data.codeText, {
      typeNumber: 4,
      errorCorrectLevel: 'M',
      size: 500
    })
    // 返回输出base64编码imgData

DEMO示例图

demo-img

TODO

  1. 组件化,适应 mpvue , wepy
  2. 更多配置项,灵活多样
  3. 样式自定义化,增加更丰富的样式

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.