Уменьшил отступы у qr
This commit is contained in:
@@ -2,6 +2,7 @@ import { ref, nextTick } from 'vue'
|
|||||||
import QRCode from 'qrcode'
|
import QRCode from 'qrcode'
|
||||||
|
|
||||||
const BASE_QR_SIZE = 256
|
const BASE_QR_SIZE = 256
|
||||||
|
const QR_MARGIN = 1
|
||||||
const MAX_WIDTH_RATIO = 0.8
|
const MAX_WIDTH_RATIO = 0.8
|
||||||
const MIN_SCALE = 0.5
|
const MIN_SCALE = 0.5
|
||||||
const SCALE_STEP = 0.1
|
const SCALE_STEP = 0.1
|
||||||
@@ -40,7 +41,7 @@ export function useQrCode() {
|
|||||||
if (!canvas || !userText) return
|
if (!canvas || !userText) return
|
||||||
|
|
||||||
const width = Math.round(BASE_QR_SIZE * scale.value)
|
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')
|
qrDataUrl.value = canvas.toDataURL('image/png')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user