What is qrcode.vue?
qrcode.vue is a Vue.js component for generating QR codes. It provides a simple and flexible way to create QR codes in your Vue applications.
What are qrcode.vue's main functionalities?
Basic QR Code Generation
This feature allows you to generate a basic QR code by providing a value (e.g., a URL) to the `qrcode-vue` component.
<template>
<qrcode-vue value="https://example.com" />
</template>
<script>
import QrcodeVue from 'qrcode.vue';
export default {
components: {
QrcodeVue
}
};
</script>
Customizing QR Code Size
You can customize the size of the QR code by setting the `size` prop.
<template>
<qrcode-vue value="https://example.com" :size="200" />
</template>
<script>
import QrcodeVue from 'qrcode.vue';
export default {
components: {
QrcodeVue
}
};
</script>
Customizing QR Code Color
This feature allows you to customize the colors of the QR code by setting the `color` prop with `dark` and `light` values.
<template>
<qrcode-vue value="https://example.com" :color="{ dark: '#000000', light: '#ffffff' }" />
</template>
<script>
import QrcodeVue from 'qrcode.vue';
export default {
components: {
QrcodeVue
}
};
</script>
Other packages similar to qrcode.vue
vue-qrcode-reader
vue-qrcode-reader is a Vue.js component for reading QR codes from camera or file input. Unlike qrcode.vue, which focuses on generating QR codes, vue-qrcode-reader is designed for scanning and reading QR codes.
qrcode.react
qrcode.react is a QR code generator for React applications. It provides similar functionality to qrcode.vue but is designed for use with React instead of Vue.
react-qr-code
react-qr-code is another QR code generator for React applications. It offers similar features to qrcode.vue, such as customizable size and color, but is intended for React developers.
qrcode.vue
⚠️ Now when you are using Vue 3.x, please upgrade qrcode.vue
to 3.x
🔒 if you are using Vue 2.x, please keep using version 1.x
;
A Vue.js component to generate QRCode.
中文
install
the qrcode.vue
component can use in you Vue.js app.
npm install --save qrcode.vue
dist/
|--- qrcode.vue.cjs.js // CommonJS
|--- qrcode.vue.esm.js // ES module
|--- qrcode.vue.browser.js // UMD for browser or require.js or CommonJS
|--- qrcode.vue.browser.min.js // UMD Minimum size
Usage
e.g.
import { createApp } from 'vue'
import QrcodeVue from 'qrcode.vue'
createApp({
data: {
value: 'https://example.com',
},
template: '<qrcode-vue :value="value"></qrcode-vue>',
components: {
QrcodeVue,
},
}).mount('#root')
Or single-file components with a *.vue
extension:
<template>
<qrcode-vue :value="value" :size="size" level="H" />
</template>
<script>
import QrcodeVue from 'qrcode.vue'
export default {
data() {
return {
value: 'https://example.com',
size: 300,
}
},
components: {
QrcodeVue,
},
}
</script>
Component props
value
The value content of qrcode.
size
The size of qrcode element.
render-as
- Type:
string
- Default:
canvas
Generate QRcode as canvas
or svg
. The prop svg
can work on SSR.
margin
Define how much wide the quiet zone should be.
level
qrcode Error correction level (one of 'L', 'M', 'Q', 'H'). Know more, wikipedia: QR_code.
background
- Type:
string
- Default:
#ffffff
The background color of qrcode.
foreground
- Type:
string
- Default:
#000000
The foreground color of qrcode.
class
The class name of qrcode element.
License
copyright © 2021 @scopewu, license by MIT