4 changed files with 46 additions and 2 deletions
@ -0,0 +1,23 @@ |
|||
<template> |
|||
<div ref="domRef"></div> |
|||
</template> |
|||
<script setup> |
|||
import QRCode from 'qrcodejs2' |
|||
import { ref, watch } from 'vue' |
|||
const domRef = ref(null) |
|||
const props = defineProps({ size: Number, text: String }) |
|||
watch(domRef, nxt => { |
|||
if (nxt) { |
|||
nxt.innerHTML = '' |
|||
const { size, text } = props |
|||
new QRCode(nxt, { |
|||
width: size, |
|||
height: size, |
|||
text, |
|||
colorDark: '#000', |
|||
colorLight: '#fff' |
|||
}) |
|||
} |
|||
}) |
|||
</script> |
|||
<style lang="scss" scoped></style> |
|||
Loading…
Reference in new issue