vue-barcode-scanner icon indicating copy to clipboard operation
vue-barcode-scanner copied to clipboard

after routing to other component no event is triggered

Open tobiasnitschmann opened this issue 5 years ago • 3 comments

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?

tobiasnitschmann avatar Feb 07 '20 06:02 tobiasnitschmann

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 avatar Feb 08 '20 00:02 tobiasnitschmann

@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.

ambrooo avatar Feb 18 '20 12:02 ambrooo

change created to mounted , this.$barcodeScanner.destroy() will remove all keypress listener ,

and the destroyed will trigger after created , which make scan not working

image

andrew781026 avatar Feb 26 '20 06:02 andrew781026