
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
vue-barcode-scanner
Advanced tools
============ Barcode Scanner Plugin for Vue.js
Inject plugin to your vue instance by Vue.use
then initial it in your component that need to use barcode scanner
Default Injection
import Vue from 'vue'
import VueBarcodeScanner from 'vue-barcode-scanncer'
...
// inject vue barcode scanner
Vue.use(VueBarcodeScanner)
Inject with option
// inject with option (add sound)
// sound will trigger when it's already scanned
// sound setting is false
let options = {
sound: true, // default is false
soundSrc : '/static/sound.wav'
}
Vue.use(VueBarcodeScanner, options)
Init method use for add event listener (keydown) for the scanner
this.$barcodeScanner.init(this.onBarcodeScanned)
Destroy method is for remove the listener when it's unnessessary
this.$barcodeScanner.destroy()
In your component file (.vue)
export default {
created () {
// Add barcode scan listener and pass the callback function
this.$barcodeScanner.init(callbackFunction)
},
destroyed () {
// Remove listener when component is destroyed
this.$barcodeScanner.destroy()
},
methods: {
// Create callback function to received barcode when the scanner is already done
onBarcodeScanned (barcode) {
console.log(barcode)
// do something...
}
}
}
FAQs
Barcode Scanner Plugin for Vue.js
The npm package vue-barcode-scanner receives a total of 607 weekly downloads. As such, vue-barcode-scanner popularity was classified as not popular.
We found that vue-barcode-scanner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.