QR Reader is the new version of the HJ29 QR Code Reader that allows you to decode/analyze QR codes in Vue.js 3 supported applications.
Must Read: A QRCode Generator Component for Use with Vue.js
How to make use of it:
Install and download:
# Yarn $ yarn add vue3-qr-reader # NPM $ npm i vue3-qr-reader --save
1. Import and register a QR code reader.
// globally import { createApp } from 'vue'; import App from './App.vue' import QrReader from 'vue3-qr-reader'; const app = createApp(App); app.use(QrReader); app.mount('#app') // Locally import { QrStream, QrCapture, QrDropzone } from 'vue3-qr-reader'; export default { components: { QrStream, QrCapture, QrDropzone }, };
2. Create a file upload field to check all the files you select.
<qr-capture @decode="onDecode" class="mb"></qr-capture> <div class="result"> Result: {{data}} </div>
export default defineComponent({ name: 'QrCaptureExample', components: { QrCapture }, setup() { const state = reactive({ data: null }) function onDecode(data) { state.data = data } return { ...toRefs(state), onDecode } } });
3. Access the device’s camera and scan the incoming frame continuously.
<div class="stream"> <qr-stream @decode="onDecode" class="mb"> <div style="color: red;" class="frame"></div> </qr-stream> </div> <div class="result"> Result: {{data}} </div>
export default defineComponent({ name: 'QrStreamExample', components: { QrStream }, setup() { const state = reactive({ data: null }) function onDecode(data) { state.data = data } return { ...toRefs(state), onDecode } } });
4. Create a drag-and-drop area to check all the files you’ve dropped.
<qr-dropzone class="dropzone mb" @decode="onDecode"> Drop image here. </qr-dropzone> <div class="result"> Result: {{data}} </div>
export default defineComponent({ name: 'QrDropzoneExample', components: { QrDropzone }, setup() { const state = reactive({ data: null }) function onDecode(data) { state.data = data } return { ...toRefs(state), onDecode } } });
See Demo And Download
Official Website(HJ29): Click Here
This superior jQuery/javascript plugin is developed by HJ29. For extra advanced usage, please go to the official website.