adjust to PR comments

This commit is contained in:
flisowna
2022-12-21 13:44:02 +01:00
parent cd9ea66947
commit 27f3d53ca6
4 changed files with 20 additions and 18 deletions

View File

@@ -5,9 +5,11 @@ const props = defineProps({
barcodeValue: { type: String, required: true },
barcodeFormat: { type: String, required: true },
})
const emit = defineEmits(['onClickBarcode'])
const barcodeSvgRef = ref(null)
const errorForCurrentInput = ref(false)
const generate = () => {
try {
JsBarcode(barcodeSvgRef.value, String(props.barcodeValue), {
@@ -31,12 +33,6 @@ onMounted(generate)
</script>
<template>
<svg data-testid="barcode" v-show="!errorForCurrentInput" ref="barcodeSvgRef" @click="onBarcodeClick"></svg>
<svg class="w-full" data-testid="barcode" v-show="!errorForCurrentInput" ref="barcodeSvgRef" @click="onBarcodeClick"></svg>
<slot v-if="errorForCurrentInput" name="barcodeRenderError" />
</template>
<style scoped>
svg {
width: 100%;
}
</style>