diff --git a/src/composables/useQrCode.js b/src/composables/useQrCode.js index 53a5137..6996b61 100644 --- a/src/composables/useQrCode.js +++ b/src/composables/useQrCode.js @@ -2,6 +2,7 @@ import { ref, nextTick } from 'vue' import QRCode from 'qrcode' const BASE_QR_SIZE = 256 +const QR_MARGIN = 1 const MAX_WIDTH_RATIO = 0.8 const MIN_SCALE = 0.5 const SCALE_STEP = 0.1 @@ -40,7 +41,7 @@ export function useQrCode() { if (!canvas || !userText) return const width = Math.round(BASE_QR_SIZE * scale.value) - await QRCode.toCanvas(canvas, userText, { width }) + await QRCode.toCanvas(canvas, userText, { width, margin: QR_MARGIN }) qrDataUrl.value = canvas.toDataURL('image/png') }