vue-barcode-scanner
vue-barcode-scanner copied to clipboard
after routing to other component no event is triggered
Hi,
i registered the component in the root of my vue app. When i enter the site everything works as expected. but when i change the component via vue-router no event is fired when i scan a barcode. The trick is to click anywhere on the page and after that the listener works and event is fired again as expected.
Do you have an idea?
ok, i set the timeout option and it worked. it seems to be that scanning was performed but not completed. why ever. by setting the timeout parameter the scanning interval stops and triggers the callback method.
this behavior only occurs after routing to another component.
@tobiasnitschmann how did you solve this? I have exact situation here where i move from route to route and after reaching first page after first scan, scan stop listening to event. I set callbackAfterTimeout to true, but no difference.
change created to mounted , this.$barcodeScanner.destroy() will remove all keypress listener ,
and the destroyed will trigger after created , which make scan not working