All Projects → noomerzx → Vue Barcode Scanner

noomerzx / Vue Barcode Scanner

Barcode Scanner Plugin for Vue.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Barcode Scanner

Vue Tabevents
Event-Based communication across opened tabs for Vue 2.x
Stars: ✭ 31 (-73.28%)
Mutual labels:  vue-plugin
Vue Qrcode Reader
A set of Vue.js components for detecting and decoding QR codes.
Stars: ✭ 1,240 (+968.97%)
Mutual labels:  vue-plugin
React Native Barcode Scanner Google
Barcode scanner for react native, which implements barcode detection from Google's Vision API.
Stars: ✭ 105 (-9.48%)
Mutual labels:  barcode-scanner
Vue Async Computed
Async computed properties for Vue.js
Stars: ✭ 990 (+753.45%)
Mutual labels:  vue-plugin
Zxing Typescript
Open-source, multi-format 1D/2D barcode image processing library ported from Java in TypeScript usable from node or browser
Stars: ✭ 68 (-41.38%)
Mutual labels:  barcode-scanner
V Dragged
Vue directive plugin for drag event detection.
Stars: ✭ 84 (-27.59%)
Mutual labels:  vue-plugin
Ngx Barcode Scanner
An angular barcode reader
Stars: ✭ 29 (-75%)
Mutual labels:  barcode-scanner
Vue D3
a vue.js plugin for D3
Stars: ✭ 113 (-2.59%)
Mutual labels:  vue-plugin
Vue Scroll Progress Bar
Vue.js plugin for page scroll progress bar
Stars: ✭ 76 (-34.48%)
Mutual labels:  vue-plugin
Vue Ellipse Progress
A Vue.js component to create beautiful animated circular progress bars
Stars: ✭ 101 (-12.93%)
Mutual labels:  vue-plugin
Fiscalberry
[JSON ↔ HW] Connect things using JSON API with the fiscalberry websocket server interact easily with any kind of Hardware. Another IoT solution...
Stars: ✭ 44 (-62.07%)
Mutual labels:  barcode-scanner
Scannermapp
A QR-code and barcode acanner app built in Delphi using ZXing and TFrameStand
Stars: ✭ 65 (-43.97%)
Mutual labels:  barcode-scanner
Vue Toastr
Vuejs Toast : Plugin and Component Capability.
Stars: ✭ 93 (-19.83%)
Mutual labels:  vue-plugin
Qr Code Scanner
📠 A simple, fast and useful progressive web application
Stars: ✭ 982 (+746.55%)
Mutual labels:  barcode-scanner
Eflinventory V2
🏬 Point-of-sale and inventory tracking for small-scale retail stores. Easily manage inventory, purchases, sales, and damaged and/or expired products.
Stars: ✭ 106 (-8.62%)
Mutual labels:  barcode-scanner
Mlkit
A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Stars: ✭ 949 (+718.1%)
Mutual labels:  barcode-scanner
Barcodescanner.xf
Barcode Scanner using GoogleVision API for Xamarin Form
Stars: ✭ 82 (-29.31%)
Mutual labels:  barcode-scanner
Vue Plugin Simple
A template to create vue plugins and shareable components.
Stars: ✭ 114 (-1.72%)
Mutual labels:  vue-plugin
Barcodescanner
🔎 A simple and beautiful barcode scanner.
Stars: ✭ 1,527 (+1216.38%)
Mutual labels:  barcode-scanner
Vue Core Image Upload
a vue plugin for image to crop and upload
Stars: ✭ 1,321 (+1038.79%)
Mutual labels:  vue-plugin

Vue Barcode Scanner

Barcode Scanner Plugin for Vue.js

Features

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.

This plugin allows for better control of scanning inputs as speed of scanners lead to noisy and innacurate results. This plugin will allow you to use your already implemented barcode scanner in your project with better control and accuracy.

vue-barcode-scanner is a throttle for existing barcode scanners such as https://github.com/serratus/quaggaJS or https://github.com/hypery2k/cordova-barcodescanner-plugin/. vue-barcode-scanner is not a scanning tool on its own.

What's the problem

  • The listener will alway trigger for each character input, So we need to put it together and check when it's finished and ready to use.
  • Need to handle some special characters for some scanner, Because it's not the same for all scanner.

What this plugin do for you

  • Handle the listener for you and return the ready barcode to your callback just once when scanning is finished.
  • Handle special characters and return the complete barcode to you.

Update

  • Tab suffix barcode scanner compatibility
  • Listener for keypress instead of keydown (0.2)
  • New method to get previous barcode (0.2)
  • Listen to for all keypress not only textbox or textarea like previous version (0.3)
  • Check the input is come from barcode scanner by check elapsed time less than 500ms (0.3)
  • Support scanner that use "TAB" instead of "Enter" in the last scanned charactor (adding keydown event) (0.4)
  • Clear elapsed time when submit the barcode (0.4)
  • Change by pass elapsed time from 500ms to 30ms and change the logic to make scanner detection better (0.4)
  • Options to set scan sensitivity (it's elapsed time for each key scanned, default 100ms) (0.5)
  • New method to set scan sensitivity manually (0.5)
  • New option to require 'data-barcode' attribute for specific field input (0.6)

Dependencies

  • vue

Installation

Install via npm

npm install vue-barcode-scanner

Initiate

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-scanner'

...

// 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
  sensitivity: 300, // default is 100
  requiredAttr: true, // default is false
  controlSequenceKeys: ['NumLock', 'Clear'], // default is null
  callbackAfterTimeout: true // default is false
}

Vue.use(VueBarcodeScanner, options)

  • Please note that if "requiredAttr" set to "true" you need to specific some input field with "data-barcode" and then only this input response to scanner
  • controlSequenceKeys: when a control key in this list is encountered in a scan sequence, it will be replaced with tags for easy string replacement
  • callbackAfterTimeout: this will fire the callback defined in the component once sensitivity ms has elapsed, following the last character in the barcode sequence. This is useful for scanners that don't end their sequences with ENTER and is backwards compatible with scanners that do.

Methods

init

Init method use for add event listener (keypress) for the scanner.

this.$barcodeScanner.init(callbackFunction, options)

options defaults to an empty object, {}, and can be safely ignored. See Advanced Usage for an example.

destroy

Destroy method is for remove the listener when it's unnecessary.

this.$barcodeScanner.destroy()

hasListener

Return the value that currently has a listener or not.

this.$barcodeScanner.hasListener() // return Boolean

getPreviousCode

Return last barcode scanned whatever your input is (In textbox currently). The last barcode will be replace when hit enter key.

this.$barcodeScanner.getPreviousCode() // return String

setSensitivity

Set limit of the time elapsed between each key stroke to distinguish between human typing and barcode scanner. Barcode scanner is determined by how fast between each key stoke. Argument is number of milliseconds.

this.$barcodeScanner.setSensitivity(200) // sets barcode scanner recognition sensitivity to 200 ms

Usage

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 receive barcode when the scanner is already done
      onBarcodeScanned (barcode) {
        console.log(barcode)
        // do something...
      },
      // Reset to the last barcode before hitting enter (whatever anything in the input box)
      resetBarcode () {
        let barcode = this.$barcodeScanner.getPreviousCode()
        // do something...
      }
    }
  }

Advanced (using eventBus)

  export default {
    data: () => ({
      loading: false
    }),
    created () {
      // Pass an options object with `eventBus: true` to receive an eventBus back
      // which emits `start` and `finish` events
      const eventBus = this.$barcodeScanner.init(this.onBarcodeScanned, { eventBus: true })
      if (eventBus) {
        eventBus.$on('start', () => { this.loading = true })
        eventBus.$on('finish', () => { this.loading = false })
      }
    },
    destroyed () {
      // Remove listener when component is destroyed
      this.$barcodeScanner.destroy()
    },
    methods: {
      // Create callback function to receive barcode when the scanner is already done
      onBarcodeScanned (barcode) {
        console.log(barcode)
        // do something...
      },
      // Reset to the last barcode before hitting enter (whatever anything in the input box)
      resetBarcode () {
        let barcode = this.$barcodeScanner.getPreviousCode()
        // do something...
      }
    }
  }

Disclaimer

This is NOT a barcode scanner. This is a scanner throttle to reduce innacurate scanner inputs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].