Skip to content

Pure JavaScript library for generating QR codes using canvas and only used in uniapp.

Notifications You must be signed in to change notification settings

alei817927/qrcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

适用于uniapp的二维码库,大部分code由QRious而来。

使用方法

  let qrcode = new Qrcode();
  qrcode.draw('myCanvas', 'https://u.wechat.com/EJab_1QbJTgyO7tcgynIyBE');

创建对象可传入参数,具体可以参看源码./js/qrcode/qrcode.js

Example

<template>
  <view class="qrcode-body">
    <view class="qrcode">
      <canvas canvas-id="myCanvas"/>
    </view>
  </view>
</template>
<script>
  import Qrcode from './js/qrcode/qrcode.js'

  export default {
    onLoad() {
      let qrcode = new Qrcode({
        'level': 'L',
        'size': 200
      });
      qrcode.draw('myCanvas', 'https://u.wechat.com/EJab_1QbJTgyO7tcgynIyBE');
    }
  }
</script>
<style>
  .qrcode-body {
    width: 100%;
  }

  .qrcode-body .qrcode {
    display: flex;
    justify-content: center;
  }
  canvas{
    height: 370px;
    width: 370px;
  }
</style>

About

Pure JavaScript library for generating QR codes using canvas and only used in uniapp.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published