Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useQRCode.md
1---2category: '@Integrations'3---45# useQRCode67Wrapper for [`qrcode`](https://github.com/soldair/node-qrcode).89## Install1011```bash12npm i qrcode@^113```1415## Usage1617```ts18import { useQRCode } from '@vueuse/integrations/useQRCode'1920// `qrcode` will be a ref of data URL21const qrcode = useQRCode('text-to-encode')22```2324or passing a `ref` to it, the returned data URL ref will change along with the source ref's changes.2526```ts27import { useQRCode } from '@vueuse/integrations/useQRCode'28import { shallowRef } from 'vue'2930const text = shallowRef('text-to-encode')31const qrcode = useQRCode(text)32```3334```html35<input v-model="text" type="text" />36<img :src="qrcode" alt="QR Code" />37```3839## Type Declarations4041```ts42/**43* Wrapper for qrcode.44*45* @see https://vueuse.org/useQRCode46* @param text47* @param options48*/49export declare function useQRCode(50text: MaybeRefOrGetter<string>,51options?: QRCode.QRCodeToDataURLOptions,52): ShallowRef<string, string>53```54