Skip to content

Commit

Permalink
fix: remember last selected camera
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleSound committed Oct 12, 2024
1 parent 5eceaf8 commit fc8511c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/components/Scan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ watchEffect(() => {
selectedCamera.value = cameras.value[0]?.deviceId
})
watch(cameras, () => {
if (selectedCamera.value && cameras.value.filter(i => i.deviceId === selectedCamera.value).length === 0)
selectedCamera.value = ''
})
// const results = defineModel<Set<string>>('results', { default: new Set() })
let qrScanner: QrScanner | undefined
watch(cameras, () => {
if (selectedCamera.value && cameras.value.find(i => i.deviceId === selectedCamera.value))
qrScanner?.setCamera(selectedCamera.value)
})
const error = ref<any>()
const video = shallowRef<HTMLVideoElement>()
const videoWidth = ref(0)
Expand Down

0 comments on commit fc8511c

Please sign in to comment.