You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I am using vuejs for my application and need to integrate onscan js with that. I ma facing below issues -
I added onscanjs under main.js and import it so that I can use it anywhere in the whole application.
Once, I go to my components, it doesn't find onscan js at all. So I removed it from main.js and imported it under every componenet where its needed.
Now, it is trying to mount onscan every time a scan is done which is giving me console errors and the scan works for the first time only (when there is no console error)
Please help
The text was updated successfully, but these errors were encountered:
I added it yesterday and works fine
in main.js:
import onScan from 'onscan.js';
onScan.attachTo(window); // add second argument of options if you need
Then in components use:
mounted() {
window.addEventListener('scan', this.handlePaste);
},
destroyed() {
window.removeEventListener('scan', this.handlePaste);
},
where this.handlePaste is a method that receives an event as parameter.
Depends on the application, you can put the mounted/destroyed functionality in a parent component and communicate through events/bus without needing to write it in multiple children components.
Hi I am using vuejs for my application and need to integrate onscan js with that. I ma facing below issues -
Please help
The text was updated successfully, but these errors were encountered: