Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
vue-barcode-scanner
Advanced tools
============
Barcode Scanner Plugin for Vue.js
Usually in the market have a lot of barcode scanner. So we need to handle a lot of things to make this input right as it was for all scanner.
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 barcode scanner with option (add sound effect)
// sound will trigger when it's already scanned
let options = {
sound: true, // default is false
soundSrc : '/static/sound.wav' // default is blank
}
Vue.use(VueBarcodeScanner, options)
Init method use for add event listener (keydown) for the scanner
this.$barcodeScanner.init(callbackFunction)
Destroy method is for remove the listener when it's unnessessary
this.$barcodeScanner.destroy()
Return the value that curently has a listener or not
this.$barcodeScanner.hasListenr() // return Boolean
In your component file (.vue) just for the component you need to listener for barcode
export default {
created () {
// Add barcode scan listener and pass the callback function
this.$barcodeScanner.init(this.onBarcodeScanned)
},
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 737 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.