
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
vue3-barcode-qrcode-reader
Advanced tools
A Vue.js set of components to scan barcodes and QR codes.
The easiest way to use Vue Barcode Reader is to install it from npm or yarn.
npm install vue3-barcode-qrcode-reader --save
Or
yarn add vue3-barcode-qrcode-reader
For Vue 2.0 compatible version please use the vue-barcode-reader.
The Vue3 Barcode and QR code scanner 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.
import { StreamQrcodeBarcodeReader } from 'vue-barcode-reader'
In your template you can use this syntax:
<StreamQrcodeBarcodeReader
capture="shoot"
@loaded="onLoaded"
@onloading="onLoading"
@result="onResult"
/>
Parameter | value | Type | Description |
---|---|---|---|
capture | "shoot" or "stream" | emun | Props capture |
When the barcode or QR code is successfully scanned, the scanning process will stop.
When the barcode or QR code is successfully scanned, the scanning process will not stop.
The library emits the following events:
Parameter | type |
---|---|
loaded | function |
onloading | function(payload) |
result | function(payload) |
When the libraty is loaded and the camera is ready to scan
for get value loading from component.
const isLoading = ref(false)
function onLoading(loading) {
isLoading.value = loading
}
const isLoading = ref<boolean>(false)
function onLoading(loading: boolean) {
isLoading.value = loading
}
When a barcode or QR code is scanned. The result is passed as a parameter to the event handler. The result is the object with the following properties:
//example
{
"text": "9578545203541",
"rawBytes": null,
"numBits": 0,
"resultPoints": [
{
"x": 29.5,
"y": 1016
},
{
"x": 394.5,
"y": 1016
}
],
"format": 7,
"timestamp": 1700195512963,
"resultMetadata": null
}
If you want to implement it in your code, you can follow this example:
const resultScan = ref(undefined)
function onResult(result) {
resultScan.value = result
}
import { Result } from 'vue-barcode-reader'
const resultScan = ref<Result | undefined>(undefined)
function onResult(result: Result | undefined) {
resultScan.value = result
}
<!-- result automaticly "text": "9578545203541" not object like example on top -->
<p>{{ resultScan }}</p>
<!-- note: if you want properties like the example above, you can assign the properties one by one in the variable-->
FAQs
Vue 3 barcodes and QR codes scanner
We found that vue3-barcode-qrcode-reader 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.