Enhance Barcode Input and File Input Components with Client-Only Wrapper

- Updated `nuxt.config.ts` to include `@zxing/library` in the transpile list, ensuring compatibility with the new barcode scanning functionality.
- Modified `BarcodeInput.vue` and `FileInput.vue` components to wrap the `CameraUpload` component in a `<ClientOnly>` tag, preventing server-side rendering issues and improving the user experience during barcode scanning.

These changes aim to enhance the functionality of the barcode scanning feature while ensuring proper rendering in client-side environments.
This commit is contained in:
Julien Nahum 2025-05-30 11:49:13 +02:00
parent b47a528075
commit 9a42aacc3a
3 changed files with 6 additions and 2 deletions

View File

@ -8,12 +8,14 @@
v-if="isScanning" v-if="isScanning"
class="relative w-full" class="relative w-full"
> >
<ClientOnly>
<CameraUpload <CameraUpload
:is-barcode-mode="true" :is-barcode-mode="true"
:decoders="decoders" :decoders="decoders"
@stop-webcam="stopScanning" @stop-webcam="stopScanning"
@barcode-detected="handleBarcodeDetected" @barcode-detected="handleBarcodeDetected"
/> />
</ClientOnly>
</div> </div>
<div <div

View File

@ -10,12 +10,14 @@
theme.fileInput.minHeight theme.fileInput.minHeight
]" ]"
> >
<camera-upload <ClientOnly>
<CameraUpload
v-if="cameraUpload" v-if="cameraUpload"
:theme="theme" :theme="theme"
@upload-image="cameraFileUpload" @upload-image="cameraFileUpload"
@stop-webcam="isInWebcam=false" @stop-webcam="isInWebcam=false"
/> />
</ClientOnly>
</div> </div>
<div <div
v-else v-else

View File

@ -22,7 +22,7 @@ export default defineNuxtConfig({
], ],
build: { build: {
transpile: ["vue-notion", "query-builder-vue-3", "vue-signature-pad"], transpile: ["vue-notion", "query-builder-vue-3", "vue-signature-pad", "@zxing/library"],
}, },
i18n: { i18n: {