Skip to content

Commit

Permalink
fix: forced type conversion.
Browse files Browse the repository at this point in the history
github issue #85
  • Loading branch information
scopewu committed Oct 17, 2024
1 parent c0e7227 commit 8e42a8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qrcode.vue",
"version": "3.5.0",
"version": "3.5.1",
"description": "A Vue.js component to generate QRCode. Both support Vue 2 and Vue 3",
"type": "module",
"main": "./dist/qrcode.vue.cjs.js",
Expand Down
17 changes: 9 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ export const QrcodeSvg = defineComponent({
let imageProps: { x: number, y: number, width: number, height: number }

const generate = () => {
const { value, level, margin } = props
const { value, level: _level, margin: _margin } = props
const margin = _margin >>> 0
const level = validErrorCorrectLevel(_level) ? _level : defaultErrorCorrectLevel

let cells = QR.QrCode.encodeText(value, ErrorCorrectLevelMap[level]).getModules()
numCells.value = cells.length + margin * 2
Expand Down Expand Up @@ -253,7 +255,9 @@ export const QrcodeCanvas = defineComponent({
const imageRef = ref<HTMLImageElement | null>(null)

const generate = () => {
const { value, level, size, margin, background, foreground } = props
const { value, level: _level, size, margin: _margin, background, foreground } = props
const margin = _margin >>> 0
const level = validErrorCorrectLevel(_level) ? _level : defaultErrorCorrectLevel

const canvas = canvasEl.value

Expand Down Expand Up @@ -355,16 +359,13 @@ const QrcodeVue = defineComponent({
const {
renderAs,
value,
size: _size,
margin: _margin,
level: _level,
size,
margin,
level,
background,
foreground,
imageSettings,
} = this.$props
const size = _size >>> 0
const margin = _margin >>> 0
const level = validErrorCorrectLevel(_level) ? _level : defaultErrorCorrectLevel

return h(
renderAs === 'svg' ? QrcodeSvg : QrcodeCanvas,
Expand Down

0 comments on commit 8e42a8a

Please sign in to comment.