Fix QR scanner loading state condition and remove unused video element reference
- Updated the loading state condition in qr-scanner.vue to check for camera permission correctly. - Removed the unused videoElement reference in useQRScanner.ts to clean up the code. These changes improve the functionality and clarity of the QR scanner component.
This commit is contained in:
parent
bebdc3c24c
commit
d31db59359
2 changed files with 1 additions and 3 deletions
|
|
@ -44,7 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Loading state -->
|
<!-- Loading state -->
|
||||||
<div v-if="!isScanning && hasPermission !== false" class="absolute inset-0 flex items-center justify-center bg-black/50">
|
<div v-if="!isScanning && hasPermission === true" class="absolute inset-0 flex items-center justify-center bg-black/50">
|
||||||
<div class="text-center text-white">
|
<div class="text-center text-white">
|
||||||
<Loader2 class="w-8 h-8 animate-spin mx-auto mb-2" />
|
<Loader2 class="w-8 h-8 animate-spin mx-auto mb-2" />
|
||||||
<p class="text-sm">Starting camera...</p>
|
<p class="text-sm">Starting camera...</p>
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,10 @@ export function useQRScanner() {
|
||||||
const scanResult = ref<string | null>(null)
|
const scanResult = ref<string | null>(null)
|
||||||
|
|
||||||
let qrScanner: QrScanner | null = null
|
let qrScanner: QrScanner | null = null
|
||||||
let videoElement: HTMLVideoElement | null = null
|
|
||||||
|
|
||||||
const startScanning = async (videoEl: HTMLVideoElement, onResult: (result: string) => void) => {
|
const startScanning = async (videoEl: HTMLVideoElement, onResult: (result: string) => void) => {
|
||||||
try {
|
try {
|
||||||
error.value = null
|
error.value = null
|
||||||
videoElement = videoEl
|
|
||||||
|
|
||||||
// Check if camera is available
|
// Check if camera is available
|
||||||
const hasCamera = await QrScanner.hasCamera()
|
const hasCamera = await QrScanner.hasCamera()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue