File tree Expand file tree Collapse file tree 2 files changed +55
-2
lines changed
docs/.vitepress/components/demos Expand file tree Collapse file tree 2 files changed +55
-2
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
+ <p >
4
+ By default only QR-codes are detected but a variety of other barcode formats are also
5
+ supported. You can select one or multiple but the more you select the more expensive scanning
6
+ becomes: <br />
7
+
8
+ <span
9
+ v-for =" option in Object.keys(barcodeFormats)"
10
+ :key =" option"
11
+ class =" barcode-format-checkbox"
12
+ >
13
+ <input
14
+ type =" checkbox"
15
+ v-model =" barcodeFormats[option]"
16
+ :id =" option"
17
+ />
18
+ <label :for =" option" >{{ option }}</label >
19
+ </span >
20
+ </p >
21
+
3
22
<p class =" decode-result" >
4
23
Last result: <b >{{ result }}</b >
5
24
</p >
15
34
@detect =" onDetect"
16
35
@dragover =" onDragOver"
17
36
@error =" logErrors"
37
+ :formats =" selectedBarcodeFormats"
18
38
>
19
39
<div
20
40
class =" drop-area"
29
49
<script >
30
50
import { QrcodeDropZone } from ' ../../../../src'
31
51
52
+ /** * barcode formats ***/
53
+
32
54
export default {
33
55
components: { QrcodeDropZone },
34
56
35
57
data () {
36
58
return {
37
59
result: null ,
38
60
error: null ,
39
- dragover: false
61
+ dragover: false ,
62
+ barcodeFormats: {
63
+ aztec: false ,
64
+ code_128: false ,
65
+ code_39: false ,
66
+ code_93: false ,
67
+ codabar: false ,
68
+ databar: false ,
69
+ databar_expanded: false ,
70
+ data_matrix: false ,
71
+ dx_film_edge: false ,
72
+ ean_13: false ,
73
+ ean_8: false ,
74
+ itf: false ,
75
+ maxi_code: false ,
76
+ micro_qr_code: false ,
77
+ pdf417: false ,
78
+ qr_code: true ,
79
+ rm_qr_code: false ,
80
+ upc_a: false ,
81
+ upc_e: false ,
82
+ linear_codes: false ,
83
+ matrix_codes: false
84
+ }
40
85
}
41
86
},
42
87
88
+ computed: {
89
+ selectedBarcodeFormats () {
90
+ return Object
91
+ .keys (this .barcodeFormats )
92
+ .filter (format => this .barcodeFormats [format])
93
+ }
94
+ },
95
+
43
96
methods: {
44
97
onDetect (detectedCodes ) {
45
98
console .log (detectedCodes)
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ const onDrop = ({ dataTransfer }: DragEvent) => {
46
46
const droppedUrl = dataTransfer .getData (' text/uri-list' )
47
47
48
48
droppedFiles .forEach ((file : File ) => {
49
- onDetect (processFile (file ))
49
+ onDetect (processFile (file , props . formats ))
50
50
})
51
51
52
52
if (droppedUrl !== ' ' ) {
You can’t perform that action at this time.
0 commit comments