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 fc8511c commit 0a2868e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/components/Scan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ watchEffect(() => {
let qrScanner: QrScanner | undefined
watch(cameras, () => {
if (selectedCamera.value && cameras.value.find(i => i.deviceId === selectedCamera.value))
qrScanner?.setCamera(selectedCamera.value)
if (selectedCamera.value && cameras.value.find(i => i.deviceId === selectedCamera.value)) {
setTimeout(() => {
qrScanner?.setCamera(selectedCamera.value!)
}, 250)
}
})
const error = ref<any>()
Expand Down

0 comments on commit 0a2868e

Please sign in to comment.