Qr code generator component

vueuse - useQRCode, useShare

Enter text:

Enter filename:

Size
https://github.com/leovoon/

How to Use

  <qr-generator 
  :input-text="yourTextToGenerate" 
  :title="yourTitle"
  img-width="200"
  img-height="200"
  click-to-download />
PropsTypeOptional
input-textStringno
titleStringyes
img-widthStringyes
img-heightStringyes
click-to-downloadBooleanyes

Code

// QrGenerator.vue
  <a
    v-if="clickToDownload"
    :href="qrCode"
    :download="title"
  >
    <img
      :src="qrCode"
      :alt="inputText"
      :width="imgWidth"
      :height="imgHeight"
    />
  </a>

  <img
    v-else
    :src="qrCode"
    :alt="inputText"
    :width="imgWidth"
    :height="imgHeight"
  />
<script setup lang='ts'>
import { useQRCode } from '@vueuse/integrations/useQRCode'

const props = defineProps({
  inputText: {
    type: String,
    require: true,
  },
  title: {
    type: String,
    default: 'https://google.com',
    require: false,
  },
  imgWidth: {
    type: String,
    default: '200',
    require: false,
  },
  imgHeight: {
    type: String,
    default: '200',
    require: false,
  },
  clickToDownload: {
    type: Boolean,
    default: true,
  },

})

const qrCode = useQRCode(props.inputText)
</script>

that’s it.

Made withby leovoon