QR Code
Wrapper for qrcode .
⚡️ Prerequisites
npm install --save qrcode
npm install --save qrcode
sh
Usage
<script>
import {qrcode} from "@sveu/extend/qrcode"
const {output, pending, error} = qrcode("Hello")
</script>
<script>
import {qrcode} from "@sveu/extend/qrcode"
const {output, pending, error} = qrcode("Hello")
</script>
svelte
Example
Pending.........
<script>
import { qrcode } from "@sveu/extend/qrcode"
let value = "world"
$: ({ output, pending, error } = qrcode(value))
</script>
<div class="grid place-items-center">
{#if $pending}
<p>Pending.........</p>
{:else}
<img src="{$output}" alt="qrcode" />
<br />
{#if $error}
<p class="text-red-500">{$error}</p>
{/if}
<br />
{/if}
<input class="border border-4" bind:value="{value}" />
</div>
<script>
import { qrcode } from "@sveu/extend/qrcode"
let value = "world"
$: ({ output, pending, error } = qrcode(value))
</script>
<div class="grid place-items-center">
{#if $pending}
<p>Pending.........</p>
{:else}
<img src="{$output}" alt="qrcode" />
<br />
{#if $error}
<p class="text-red-500">{$error}</p>
{/if}
<br />
{/if}
<input class="border border-4" bind:value="{value}" />
</div>
svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Click fold/expand code
API
Arguments
Name | Description | Type | Required |
---|---|---|---|
text | The text to encode | string | Yes |
Options
Read the qrcode documentation