A Nuxt module that provides support for generating and reading QRCodes.
Nuxt QRCode is a module to provide easy support in reading and creating QR Codes.
The following are the features that I’m currently working on and plan to release in the upcoming days/weeks
Read QRCodes
Generate QRCodes
nuxt-qrcode dependency to your project# Using pnpm
pnpm add -D nuxt-qrcode
# Using yarn
yarn add --dev nuxt-qrcode
# Using npm
npm install --save-dev nuxt-qrcode
nuxt-qrcode to the modules section of nuxt.config.tsexport default defineNuxtConfig({
modules: [
'nuxt-qrcode'
]
})
That’s it! You can now use Nuxt QRCode in your Nuxt app ✨
You can set default options within your nuxt.config.ts
Qrcode and useQrcodeYou can customize things like:
0 is none, 1 is full)export default defineNuxtConfig({
modules: ['nuxt-qrcode'],
qrcode: {
options: {
variant: 'pixelated',
// OR
variant: {
inner: 'circle',
marker: 'rounded',
pixel: 'rounded',
},
radius: 1,
blackColor: 'currentColor', // 'var(--ui-text-highlighted)' if you are using `@nuxt/ui` v3
whiteColor: 'transparent', // 'var(--ui-bg)'
},
},
})
QrcodeThe Qrcode component only requires a value prop to work
<template>
<div>
<Qrcode
value="My string to encode"
variant="pixelated"
/>
</div>
</template>
But it also accepts all the same props available at qrcode.options in your nuxt.config.ts.
QrcodeStreamReady to use component to capture and decode a live feed from the device’s camera. As simple as:
<template>
<div>
<QrcodeStream
@error="onError"
@detect="onDetect"
/>
</div>
</template>
<script setup lang="ts">
import type { DetectedBarcode } from 'nuxt-qrcode'
function onDetect(detectedCodes: DetectedBarcode[]) {
// do something with decoded qrcodes `DetectedBarcode['rawValue']
}
function onError(err: Error) {
// do something on stream error
}
</script>
QrcodeCaptrue and QrcodeDropZoneFollow the documentation on qrcode.s94.dev to learn how to use these components.
# Install dependencies
pnpm install
# Generate type stubs
pnpm run dev:prepare
# Develop with the playground
pnpm run dev
# Build the playground
pnpm run dev:build
# Run ESLint
pnpm run lint
# Run Vitest
pnpm run test
pnpm run test:watch
# Release new version
pnpm run release
Published under the MIT license.
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.