|
|
@@ -0,0 +1,27 @@
|
|
|
+<script setup lang="ts">
|
|
|
+// eslint-disable-next-line ts/ban-ts-comment
|
|
|
+// @ts-expect-error
|
|
|
+
|
|
|
+import UQRCode from 'uqrcodejs'
|
|
|
+
|
|
|
+const props = defineProps<{ text: string, qwidth: number }>()
|
|
|
+const _this = getCurrentInstance()
|
|
|
+function createQRCode() {
|
|
|
+ const qr = new UQRCode()
|
|
|
+ qr.data = props.text
|
|
|
+ qr.size = props.qwidth || 100
|
|
|
+ qr.make()
|
|
|
+ const canvasContext = uni.createCanvasContext('qrcode', _this)
|
|
|
+ qr.canvasContext = canvasContext
|
|
|
+ qr.drawCanvas()
|
|
|
+}
|
|
|
+createQRCode()
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <canvas id="qrcode" canvas-id="qrcode" :style="{ width: `${props.qwidth}px`, height: `${props.qwidth}px` }" />
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|