Skip to content

witQrCode QR Code Generator

witQrCode is a QR code generation component based on vue-qr, provides a simple and easy-to-use API to generate various styles of QR codes. The component supports custom QR code content, size, color, margin and other properties, suitable for scenarios where QR codes need to be displayed on pages.

Usage Example

vue
<template>
  <div>
    <!-- Basic usage -->
    <witQrCode value="https://www.example.com" />
    
    <!-- Custom size and color -->
    <witQrCode 
      value="https://www.example.com" 
      :size="200"
      color="#000000"
      background="#ffffff"
    />
    
    <!-- QR code with logo -->
    <witQrCode 
      value="https://www.example.com" 
      :size="200"
      logoSrc="/path/to/logo.png"
      :logoScale="0.2"
    />
  </div>
</template>

<script lang="ts" setup>
import witQrCode from '@/plugins/witQrCode'
</script>

API

Component

Component NameDescription
witQrCodeQR code generator main component

Properties

Property NameTypeDefault ValueDescription
valueString''QR code content (URL, text, etc.)
sizeNumber150QR code size (width and height are the same)
levelString'M'Error correction level (L, M, Q, H)
backgroundString'#ffffff'Background color
colorString'#000000'Foreground color
marginNumber10Margin
logoSrcString''Logo image address
logoScaleNumber0.2Logo scale ratio
logoMarginNumber0Logo margin
logoBackgroundColorString'#ffffff'Logo background color
logoCornerRadiusNumber0Logo corner radius
whiteMarginBooleantrueWhether to show white margin
dotScaleNumber1Dot scale ratio

Methods

Method NameDescriptionParameter Type
getQrDataURLGet QR code Data URL-

Features

Content Support

  • Supports text content
  • Supports URL links
  • Supports arbitrary string data

Style Customization

  • Custom QR code size
  • Custom foreground and background colors
  • Custom margin size
  • Supports different error correction levels

湘ICP备2024070110号