Registry / web-framework / qrcode-vue

qrcode-vue

JSON →
library1.2.0jsnpmunverified

This `qrcode-vue` package offers a Vue.js component for rendering QR codes directly within Vue applications. It utilizes the underlying `qr.js` library for all core QR code encoding functionalities, simplifying integration for Vue 2 developers. Key features include dynamic adjustment of QR code size, customization of background and foreground colors, and the ability to embed a logo image at the center of the generated QR code. While the latest version available on npm is 1.2.0, reportedly published approximately a year ago, the linked GitHub repository (l-ll/qrcode-vue) shows a severe lack of recent development, with the last commits and official releases (like v1.0.0) dating back to 2017. This strong indication of abandonment means the package is not actively maintained and lacks crucial updates or support for modern Vue ecosystems, particularly Vue 3, with which it is not inherently compatible without significant refactoring. Its release cadence is effectively non-existent, making it a risky choice for new projects.

npm install qrcode-vue
INSTALL
IMPORT
SIG · QRCODE-VUE
Q
qrcode-vue
web-frameworkjavascriptv1.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QrcodeVue
import QrcodeVue from 'qrcode-vue'; // In a Vue component's script section
import { QrcodeVue } from 'qrcode-vue';
The component is exported as the default export of the module.
QrcodeVue
import QrcodeVue from 'qrcode-vue'; Vue.component('qrcode-vue', QrcodeVue); // For global registration in main.js
import { QrcodeVue } from 'qrcode-vue'; Vue.component('qrcode-vue', QrcodeVue);
When globally registering, ensure you import the default export.
QrcodeVue
const QrcodeVue = require('qrcode-vue').default;
const QrcodeVue = require('qrcode-vue'); // Will return an object { default: Component }
In CommonJS environments, the default export is accessed via the `.default` property.

Demonstrates basic integration of `qrcode-vue` into a Vue 2 application, showing prop binding for value, size, colors, and logo, along with dynamic updates.

<template> <div id="app"> <p>Scan this QR code!</p> <qrcode-vue :size="size" :value="value" :logo="logo" :bgColor="bgColor" :fgColor="fgColor" level="H" ></qrcode-vue> <p>Current value: {{ value }}</p> <p>Size: {{ size }}px</p> <p> <button @click="changeValue">Change Value</button> <button @click="changeSize">Toggle Size</button> </p> </div> </template> <script> import QrcodeVue from 'qrcode-vue'; export default { components: { QrcodeVue }, data () { return { size: 160, bgColor: '#ffffff', fgColor: '#000000', value: 'https://checklist.day/quickstart-example', logo: 'https://vuejs.org/images/logo.png' // Using Vue logo for example } }, methods: { changeValue() { this.value = this.value === 'https://checklist.day/quickstart-example' ? 'https://github.com/l-ll/qrcode-vue' : 'https://checklist.day/quickstart-example'; }, changeSize() { this.size = this.size === 160 ? 200 : 160; } } } </script>
Debug
Known issues
breakingThis package is built for Vue 2.x and is not directly compatible with Vue 3.x applications. Attempting to use it in a Vue 3 project will result in runtime errors due to fundamental API changes.
fix
Consider using alternative QR code libraries designed for Vue 3, or manually adapt the component for Vue 3's composition API and new rendering concepts, which requires significant effort.
affects: All versions
gotchaThe primary GitHub repository (l-ll/qrcode-vue) has been inactive since 2017, and while npm shows a version 1.2.0 published roughly a year ago, the project is effectively abandoned. This means no new features, bug fixes, or security patches are expected.
fix
For new projects, prefer actively maintained QR code libraries. If already in use, be aware of potential vulnerabilities and lack of support.
affects: >=1.0.0
gotchaEmbedding a logo via the `logo` prop can lead to Cross-Origin Resource Sharing (CORS) errors if the logo image is hosted on a different domain than your application and does not provide appropriate CORS headers.
fix
Ensure the logo image is served from the same origin as your application, or configure the image server with appropriate CORS headers (e.g., `Access-Control-Allow-Origin: *`). Alternatively, host the logo image as a base64 data URL.
affects: All versions
gotchaThe underlying `qr.js` library, on which `qrcode-vue` depends, might not receive timely security updates. Using an unmaintained QR code generator could pose security risks, especially if generating QR codes from untrusted input.
fix
Regularly audit dependencies for known vulnerabilities. If handling sensitive data, consider more actively maintained alternatives that adhere to modern security practices.
affects: All versions
Errors
Common errors & fixes
[Vue warn]: Unknown custom element: <qrcode-vue> - did you register the component correctly?
The `qrcode-vue` component was imported but not registered either locally in a component or globally in the Vue instance.
fix
Ensure `QrcodeVue` is listed in the `components` option of your Vue component: `components: { QrcodeVue }` or globally registered via `Vue.component('qrcode-vue', QrcodeVue)`.
Error: Tainted canvases may not be exported. Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement'
Attempting to generate a QR code with a logo URL from a different origin without proper CORS headers.
fix
Host the logo image on the same domain as your application, ensure the image server sends `Access-Control-Allow-Origin` headers, or convert the logo image to a base64 data URL.
TypeError: Cannot read properties of undefined (reading 'value')
The `value` prop, which is mandatory for QR code generation, was not provided or was `undefined`.
fix
Always provide a valid string for the `:value` prop, e.g., `:value="myUrl"`.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
qr.jsrequiredCore QR code generation library.
Agent activity
4 hits · last 30 days
node
4
Resources
qrcode-vue — npm install qrcode-vue · libregistry