You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
362 B
17 lines
362 B
<script lang="ts"> |
|
import { onMount } from "svelte"; |
|
import QRCode from "qrcode"; |
|
|
|
export let value: string; |
|
let canvas: HTMLCanvasElement; |
|
|
|
async function renderQR() { |
|
if (canvas && value) { |
|
await QRCode.toCanvas(canvas, value, { width: 240 }); |
|
} |
|
} |
|
|
|
onMount(renderQR); |
|
</script> |
|
|
|
<canvas class="qr-code" bind:this={canvas}></canvas>
|
|
|