Gathering detailed insights and metrics for @teckel/vue-barcode-reader
Gathering detailed insights and metrics for @teckel/vue-barcode-reader
Gathering detailed insights and metrics for @teckel/vue-barcode-reader
Gathering detailed insights and metrics for @teckel/vue-barcode-reader
A Vue.js set of components to scan barcodes and QR codes.
npm install @teckel/vue-barcode-reader
Typescript
Module System
Node Version
NPM Version
55.8
Supply Chain
90.7
Quality
77.6
Maintenance
100
Vulnerability
97
License
Vue (98.52%)
JavaScript (1.48%)
Total Downloads
13,194
Last Day
12
Last Week
316
Last Month
1,098
Last Year
9,866
22 Stars
74 Commits
7 Forks
2 Watchers
1 Branches
1 Contributors
Updated on Apr 19, 2025
Minified
Minified + Gzipped
Latest Version
1.1.8
Package Id
@teckel/vue-barcode-reader@1.1.8
Unpacked Size
20.93 kB
Size
6.42 kB
File Count
5
NPM Version
9.8.0
Node Version
20.5.0
Published on
Nov 25, 2024
Cumulative downloads
Total Downloads
Last Day
-58.6%
12
Compared to previous day
Last Week
14.1%
316
Compared to previous week
Last Month
7.5%
1,098
Compared to previous month
Last Year
196.5%
9,866
Compared to previous year
1
A Vue.js set of components to scan barcodes and QR codes (or upload images).
The following bug fixes, features & improvements over the abandoned package by olefirenko
The easiest way to use Vue Barcode Reader is to install it with npm or yarn.
1npm install @teckel/vue-barcode-reader --save
Or
1yarn add @teckel/vue-barcode-reader
The Vue Barcode Reader works out of the box by just including it.
Once a stream from the users camera is loaded, it's displayed and continuously scanned for barcodes. Results are indicated by the decode event.
Composition API example:
1<script setup> 2import { ref } from 'vue' 3import { StreamBarcodeReader } from '@teckel/vue-barcode-reader' 4 5const decodedText = ref('') 6 7const onDecode = (result) => { 8 decodedText = result 9} 10 11const onLoaded = () => { 12 console.log('loaded') 13} 14</script> 15 16<template> 17 <StreamBarcodeReader 18 torch 19 no-front-cameras 20 @decode="onDecode" 21 @loaded="onLoaded" 22 /> 23 <h2>Decoded value: {{ decodedText }}</h2> 24</template>
Options API example:
1<template> 2 <StreamBarcodeReader 3 torch 4 no-front-cameras 5 @decode="onDecode" 6 @loaded="onLoaded" 7 /> 8 <h2>Decoded value: {{ decodedText }}</h2> 9</template> 10 11<script> 12import { StreamBarcodeReader } from '@teckel/vue-barcode-reader' 13 14export default { 15 components: { StreamBarcodeReader }, 16 data() { 17 return { 18 decodedText: '', 19 } 20 }, 21 methods: { 22 onDecode(result) { 23 this.decodedText = result 24 }, 25 onLoaded() { 26 console.log('loaded') 27 }, 28 } 29} 30</script>
The component renders to a simple file picker input element. Clicking opens a file dialog. On supporting mobile devices the camera is started to take a picture. The selected images are directly scanned and positive results are indicated by the decode
event.
1import { ImageBarcodeReader } from '@teckel/vue-barcode-reader'
In your template you can use this syntax:
1<ImageBarcodeReader 2 @decode="onDecode" 3 @error="onError" 4/>
Props will only work if the camera reports that the feature is supported. Some camera devices and some platforms either don't allow setting constraints or don't report the feature exists. Chrome on Android work quite well, while (as expected) iOS and Safari don't support most/all features.
torch
Activate the torch (flash). Can be set with simply torch
or controlled via :torch="torch"
.
zoom
Set the zoom value (min/max/step available in hasZoom
emitted value).
landscape
Set the browser to landscape orientation. In order to set landscape mode, the browser will first switch to fullscreen mode (this is required to force landscape mode).
autofocus
Defaults to true
, but setting :autofocus="false"
turns off autofocus (manual focus).
focus-distance
Must have
:autofocus="false"
(turning off autofocus and turning on manual focus) for focus-distance to work.
Set the focus distance (min/max/step available in hasFocusDistance
emitted value).
no-front-cameras
Only selects from rear-facing cameras. This only works if the device reports the camera's orientation.
device-index
Select the index of the camera device to use (get the camera device array from the videoDevices
emitted value).
msBetweenDecoding
Set the time between decode scans (defaults to 500ms). This is useful if you want to limit the number of scans per second (for example, if you're scanning a barcode on a moving object, you may want to limit the number of scans per second).
hasTorch
Returns true
or false
if camera device reports it's capable of activating the torch (flash).
hasAutofocus
Returns true
or false
if camera device reports it's capable of autofocus mode.
hasZoom
Returns false
or object containing min
, max
, step
set from the supported camera device.
hasFocusDistance
Returns false
or object containing min
, max
, step
set from the supported camera device.
videoDevices
Returns an array of camera devices available to the browser (can be used to select the desired camera device via device-index
prop).
cameraDetails
Object dump of the library processing to select the ideal camera, switch cameras, and apply constraints (useful for debugging or could be used for enhanced features).
loaded
When the library is loaded and the camera is ready to scan
decode
When a barcode or QR code is scanned. The result is passed as a parameter to the event handler. The result is the text encoded in the barcode or QR code.
result
When a barcode or QR code is scanned. The result is passed as a parameter to the event handler. Below is an example result object from the UPC code of a box of Kellogg's Frosted Mini-Wheats:
1{ 2 "text": "038000199349", 3 "rawBytes": null, 4 "numBits": 0, 5 "resultPoints": [ 6 { 7 "x": 189, 8 "y": 240 9 }, 10 { 11 "x": 445.5, 12 "y": 240 13 } 14 ], 15 "format": 14, 16 "timestamp": 1690401753332, 17 "resultMetadata": null 18}
Barcode formats (from above JSON object format
):
No vulnerabilities found.
No security vulnerabilities found.