vue-qr
The Vue 2.x component of Awesome-qr.js
Last updated 6 years ago by traveller .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install vue-qr 
SYNC missed versions from official npm registry.

vue-qr

Version License

The Vue 3 Component for SumiMakito's Awesome-qr.js.

The only one qr code component for Vue.js you need!

Notice

  • v5.x 仅支持 Vue 3
  • Vue 2 用户请使用 v4.x: npm install vue-qr@4
  • 不支持 IE 浏览器

Examples

Try to scan these QR codes below with your smart phone.

Example 1 Example 2 Example 3 Example 4

Demo

npm run dev

Installation

npm install vue-qr --save

Usage

Global Registration

import { createApp } from 'vue'
import { VueQr, install } from 'vue-qr'

const app = createApp(App)
app.use({ install }) // or app.component('VueQr', VueQr)
app.mount('#app')

Local Registration

<script setup>
import VueQr from 'vue-qr'
</script>

<template>
  <vue-qr text="Hello world!" />
  <vue-qr :bgSrc="src" :logoSrc="src2" text="Hello world!" :size="200" />
  <vue-qr text="Hello world!" @generated="onGenerated" qid="testid" />
</template>

Event Handling

<script setup>
function onGenerated(dataUrl, id) {
  console.log(dataUrl, id)
}
</script>

<template>
  <vue-qr text="Hello world!" @generated="onGenerated" qid="testid" />
</template>

Props

Parameter Type Default Explanation
text String (required) Contents to encode
correctLevel Number 1 Correct Level 0-3
size Number 200 Width and height of the output QR code, includes margin
margin Number 20 Margin around the QR code
colorDark String '#000000' Color of data blocks
colorLight String '#FFFFFF' Color of empty space
components Object - Controls appearances of parts. See ComponentOptions
bgSrc String - Background image URL
gifBgSrc String - GIF background URL (overrides bgSrc)
backgroundColor String '#FFFFFF' Background color
backgroundDimming String 'rgba(0,0,0,0)' Color mask above background image
logoSrc String - Logo URL at center
logoScale Number 0.2 Logo size = logoScale * (size - 2 * margin)
logoMargin Number 0 White margin around logo
logoBackgroundColor String 'rgba(255,255,255,1)' Logo background color
logoCornerRadius Number 8 Logo corner radius
whiteMargin Boolean true White border around background image
dotScale Number 1 Data dots scale (0 < scale ≤ 1)
autoColor Boolean true Use dominant color of background as colorDark
binarize Boolean false Binarize the image
binarizeThreshold Number 128 Binarize threshold (0-255)
bindElement Boolean true Auto-binds generated QR to HTML element
qid String - ID for async identification

Events

Event Parameters Description
generated (dataUrl, qid) Emitted when QR code is generated

ComponentOptions

type ComponentOptions = {
  data?: { scale?: number }
  timing?: { scale?: number; protectors?: boolean }
  alignment?: { scale?: number; protectors?: boolean }
  cornerAlignment?: { scale?: number; protectors?: boolean }
}

Default:

{
  data: { scale: 1 },
  timing: { scale: 1, protectors: false },
  alignment: { scale: 1, protectors: false },
  cornerAlignment: { scale: 1, protectors: true }
}

For more details check out Awesome-qr.js

Current Tags

  • 4.0.4                                ...           alpha (4 years ago)
  • 4.0.8-beta.0                                ...           beta (4 years ago)
  • 4.0.9                                ...           latest (4 years ago)

73 Versions

  • 4.0.9                                ...           4 years ago
  • 4.0.8                                ...           4 years ago
  • 4.0.8-beta.0                                ...           4 years ago
  • 4.0.7                                ...           4 years ago
  • 4.0.7-beta.2                                ...           4 years ago
  • 4.0.7-beta.1                                ...           4 years ago
  • 4.0.7-beta.0                                ...           4 years ago
  • 4.0.6                                ...           4 years ago
  • 4.0.5                                ...           4 years ago
  • 4.0.4-beta.3                                ...           4 years ago
  • 4.0.4-beta.2                                ...           4 years ago
  • 4.0.4-beta.1                                ...           4 years ago
  • 4.0.4-beta.0                                ...           4 years ago
  • 4.0.4                                ...           4 years ago
  • 4.0.3                                ...           4 years ago
  • 4.0.2                                ...           4 years ago
  • 4.0.1                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.2.4                                ...           4 years ago
  • 3.2.3                                ...           4 years ago
  • 3.2.2                                ...           5 years ago
  • 3.2.1                                ...           5 years ago
  • 3.2.0                                ...           5 years ago
  • 3.1.0                                ...           5 years ago
  • 2.5.0                                ...           5 years ago
  • 2.4.0                                ...           5 years ago
  • 2.4.0-rc.1                                ...           5 years ago
  • 2.4.0-rc.0                                ...           5 years ago
  • 2.3.1                                ...           5 years ago
  • 2.3.0                                ...           6 years ago
  • 2.2.1                                ...           6 years ago
  • 2.2.0                                ...           6 years ago
  • 2.1.0                                ...           7 years ago
  • 2.0.7                                ...           7 years ago
  • 2.0.6                                ...           7 years ago
  • 2.0.5                                ...           7 years ago
  • 2.0.4                                ...           7 years ago
  • 2.0.3                                ...           7 years ago
  • 2.0.2                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.5.3                                ...           7 years ago
  • 1.5.2                                ...           8 years ago
  • 1.5.1                                ...           8 years ago
  • 1.4.1                                ...           8 years ago
  • 1.4.0                                ...           8 years ago
  • 1.3.8                                ...           8 years ago
  • 1.3.7                                ...           8 years ago
  • 1.3.6                                ...           8 years ago
  • 1.3.5                                ...           8 years ago
  • 1.3.3                                ...           8 years ago
  • 1.3.0                                ...           8 years ago
  • 1.2.9                                ...           8 years ago
  • 1.2.8                                ...           8 years ago
  • 1.2.7                                ...           8 years ago
  • 1.2.6                                ...           8 years ago
  • 1.2.5                                ...           8 years ago
  • 1.2.4                                ...           8 years ago
  • 1.2.3                                ...           9 years ago
  • 1.2.2                                ...           9 years ago
  • 1.2.1                                ...           9 years ago
  • 1.2.0                                ...           9 years ago
  • 1.1.3                                ...           9 years ago
  • 1.1.2                                ...           9 years ago
  • 1.1.1                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.7                                ...           9 years ago
  • 1.0.6                                ...           9 years ago
  • 1.0.5                                ...           9 years ago
  • 1.0.4                                ...           9 years ago
  • 1.0.3                                ...           9 years ago
  • 1.0.2                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 3
This Week 14
This Month 25
Last Day 4
Last Week 9
Last Month 2
Dependencies (0)
None
Dev Dependencies (18)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |