1
- # Go Captcha Vue Package
1
+ <div align =" center " >
2
+ <img width =" 120 " style =" padding-top : 50px ; margin : 0 ;" src =" http://47.104.180.148/go-captcha/gocaptcha_logo.svg?v=1 " />
3
+ <h1 style =" margin : 0 ; padding : 0 " >Go Captcha</h1 >
4
+ <p >Behavior Captcha For Vue</p >
2
5
3
- <p > ⭐️ If it helps you, please give a star.</p >
4
- <img src =" http://47.104.180.148/go-captcha/go-captcha-v2.jpg " alt =" Poster " >
6
+ </div >
5
7
8
+ <br />
9
+
10
+ > English | [ 中文] ( README_zh.md )
6
11
7
12
<br />
8
13
14
+ <p > ⭐️ If it helps you, please give a star.</p >
15
+
16
+ <img src =" http://47.104.180.148/go-captcha/go-captcha-v2.jpg " alt =" Poster " >
17
+
18
+
9
19
| Vue Version | Go Captcha Version |
10
20
| :-----------------------| :------------------:|
11
21
| vue >= 2.7.14 && < 3.0 | go-captcha-vue@^1 |
12
22
| vue >= 3.0 | go-captcha-vue@^2 |
13
23
14
24
## Install
25
+ Greater than or equal to vue2.7.14 and less than vue3.0
15
26
``` shell
16
- # Greater than or equal to vue2.7.14 and less than vue3.0
17
27
yarn add go-captcha-vue@^1
18
28
# or
19
29
npm install go-captcha-vue@^1
20
30
# or
21
31
pnpm install go-captcha-vue@^1
32
+ ```
22
33
23
- # ###########################################
24
- # Greater than vue3.0
34
+ Greater than vue3.0
35
+ ``` shell
25
36
yarn add go-captcha-vue@^2
26
37
# or
27
38
npm install go-captcha-vue@^2
28
39
# or
29
40
pnpm install go-captcha-vue@^2
30
41
```
31
42
32
- Use Go Captcha
43
+ ## Use Go Captcha
33
44
``` ts
34
45
import " go-captcha-vue/dist/style.css"
35
46
import GoCaptcha from " go-captcha-vue"
36
47
37
48
Vue .use (GoCaptcha )
49
+
50
+ // OR
51
+ import {Click , Rotate , Slide , SlideRegion , Button } from " go-captcha-vue" ;
52
+ Vue .component (' gocaptcha-click' , Click )
53
+ Vue .component (' gocaptcha-rotate' , Rotate )
54
+ Vue .component (' gocaptcha-slide' , Slide )
55
+ Vue .component (' gocaptcha-slide-region' , SlideRegion )
56
+ Vue .component (' gocaptcha-button' , Button )
38
57
```
39
58
40
- ## 🖖 Click Mode Captcha
59
+
60
+ ## Click Mode
41
61
``` vue
42
62
<gocaptcha-click
43
63
:config="{}"
44
64
:data="{}"
45
65
:events="{}"
66
+ ref="domRef"
46
67
/>
68
+
69
+ <script>
70
+ // call methods
71
+ const domRef = ref(null)
72
+ domRef.value.clear()
73
+ domRef.value.refresh()
74
+ </script>
47
75
```
48
76
49
- ### Parameter Reference
77
+
50
78
``` ts
51
79
// config = {}
52
- interface ClickConfig {
80
+ interface Config {
53
81
width? : number ;
54
82
height? : number ;
55
83
thumbWidth? : number ;
@@ -64,43 +92,46 @@ interface ClickConfig {
64
92
}
65
93
66
94
// data = {}
67
- interface ClickData {
95
+ interface Data {
68
96
image: string ;
69
97
thumb: string ;
70
98
}
71
99
72
100
// events = {}
73
- interface ClickEvents {
101
+ interface Events {
74
102
click? : (x : number , y : number ) => void ;
75
103
refresh? : () => void ;
76
104
close? : () => void ;
77
- confirm? : (dots : Array <ClickDot >, reset : () => void ) => void ;
105
+ confirm? : (dots : Array <ClickDot >, reset : () => void ) => boolean ;
78
106
}
79
107
80
- // component call method
81
- interface ClickExpose {
82
- reset: Function ,
83
- clear: Function ,
84
- refresh: Function ,
85
- close: Function ,
108
+ // export component method
109
+ interface ExportMethods {
110
+ reset: () => void ,
111
+ clear: () => void ,
112
+ refresh: () => void ,
113
+ close: () => void ,
86
114
}
87
115
```
88
116
89
- ## 🖖 Slide Mode Captcha
117
+ ## Slide Mode
90
118
``` vue
91
119
<gocaptcha-slide
92
120
:config="{}"
93
121
:data="{}"
94
122
:events="{}"
123
+ ref="domRef"
95
124
/>
96
125
97
- <gocaptcha-slide-region
98
- :config="{}"
99
- :data="{}"
100
- :events="{}"
101
- />
126
+ <script>
127
+ // call methods
128
+ const domRef = ref(null)
129
+ domRef.value.clear()
130
+ domRef.value.refresh()
131
+ </script>
102
132
```
103
- ### Parameter Reference
133
+
134
+
104
135
``` ts
105
136
// config = {}
106
137
interface SlideConfig {
@@ -112,6 +143,7 @@ interface SlideConfig {
112
143
horizontalPadding? : number ;
113
144
showTheme? : boolean ;
114
145
title? : string ;
146
+ iconSize? : number ;
115
147
scope ? : boolean ;
116
148
}
117
149
@@ -130,17 +162,36 @@ interface SlideEvents {
130
162
move? : (x : number , y : number ) => void ;
131
163
refresh? : () => void ;
132
164
close? : () => void ;
133
- confirm? : (point : SlidePoint , reset : () => void ) => void ;
165
+ confirm? : (point : SlidePoint , reset : () => void ) => boolean ;
134
166
}
135
167
136
- // component call method
137
- interface SlideExpose {
138
- reset: Function ,
139
- clear: Function ,
140
- refresh: Function ,
141
- close: Function ,
168
+ // export component method
169
+ interface ExportMethods {
170
+ reset: () => void ,
171
+ clear: () => void ,
172
+ refresh: () => void ,
173
+ close: () => void ,
142
174
}
143
175
```
176
+
177
+ ## Drag-And-Drop Mode
178
+ ``` vue
179
+ <gocaptcha-slide-region
180
+ :config="{}"
181
+ :data="{}"
182
+ :events="{}"
183
+ ref="domRef"
184
+ />
185
+
186
+ <script>
187
+ // call methods
188
+ const domRef = ref(null)
189
+ domRef.value.clear()
190
+ domRef.value.refresh()
191
+ </script>
192
+ ```
193
+
194
+
144
195
``` ts
145
196
// config = {}
146
197
interface SlideRegionConfig {
@@ -152,6 +203,7 @@ interface SlideRegionConfig {
152
203
horizontalPadding? : number ;
153
204
showTheme? : boolean ;
154
205
title? : string ;
206
+ iconSize? : number ;
155
207
scope ? : boolean ;
156
208
}
157
209
@@ -170,31 +222,39 @@ interface SlideRegionEvents {
170
222
move? : (x : number , y : number ) => void ;
171
223
refresh? : () => void ;
172
224
close? : () => void ;
173
- confirm? : (point : SlideRegionPoint , reset : () => void ) => void ;
225
+ confirm? : (point : SlideRegionPoint , reset : () => void ) => boolean ;
174
226
}
175
227
176
- // component call method
177
- interface SlideRegionExpose {
178
- reset: Function ,
179
- clear: Function ,
180
- refresh: Function ,
181
- close: Function ,
228
+ // export component method
229
+ interface ExportMethods {
230
+ reset: () => void ,
231
+ clear: () => void ,
232
+ refresh: () => void ,
233
+ close: () => void ,
182
234
}
183
235
```
184
236
185
- ## 🖖 Rotate Mode Captcha
237
+ ## Rotation Mode
186
238
``` vue
187
239
<gocaptcha-rotate
188
240
:config="{}"
189
241
:data="{}"
190
242
:events="{}"
243
+ ref="domRef"
191
244
/>
245
+
246
+ <script>
247
+ // call methods
248
+ const domRef = ref(null)
249
+ domRef.value.clear()
250
+ domRef.value.refresh()
251
+ </script>
192
252
```
193
253
194
- ### Parameter Reference
254
+
195
255
``` ts
196
256
// config = {}
197
- interface RotateConfig {
257
+ interface Config {
198
258
width? : number ;
199
259
height? : number ;
200
260
thumbWidth? : number ;
@@ -203,40 +263,42 @@ interface RotateConfig {
203
263
horizontalPadding? : number ;
204
264
showTheme? : boolean ;
205
265
title? : string ;
266
+ iconSize? : number ;
206
267
scope ? : boolean ;
207
268
}
208
269
209
270
// data = {}
210
- interface RotateData {
271
+ interface Data {
211
272
angle: number ;
212
273
image: string ;
213
274
thumb: string ;
214
275
}
215
276
216
277
// events = {}
217
- interface RotateEvents {
278
+ interface Events {
218
279
rotate? : (angle : number ) => void ;
219
280
refresh? : () => void ;
220
281
close? : () => void ;
221
- confirm? : (angle : number , reset : () => void ) => void ;
282
+ confirm? : (angle : number , reset : () => void ) => boolean ;
222
283
}
223
284
224
- // component call method
225
- interface RotateExpose {
226
- reset: Function ,
227
- clear: Function ,
228
- refresh: Function ,
229
- close: Function ,
285
+ // export component method
286
+ interface ExportMethods {
287
+ reset: () => void ,
288
+ clear: () => void ,
289
+ refresh: () => void ,
290
+ close: () => void ,
230
291
}
231
292
```
232
293
233
294
295
+
234
296
## Button
235
297
``` vue
236
298
<gocaptcha-button @clickEvent="() => console.log('hello')"/>
237
299
```
238
300
239
- ### params
301
+
240
302
``` ts
241
303
interface $Attr {
242
304
config? : CaptchaConfig ;
@@ -249,19 +311,10 @@ interface $Event {
249
311
clickEvent? : ()=> void ; // event -> @clickEvent=""
250
312
}
251
313
252
- export interface ButtonConfig {
314
+ export interface CaptchaConfig {
253
315
width? : number ;
254
316
height? : number ;
255
317
verticalPadding? : number ;
256
318
horizontalPadding? : number ;
257
319
}
258
-
259
320
```
260
-
261
- <br />
262
-
263
- ## 👍 Sponsor
264
- <div >
265
- <a href =" http://gocaptcha.wencodes.com/sponsor/ " target =" _blank " >http://gocaptcha.wencodes.com/sponsor/ </a >
266
- </div >
267
- <br />
0 commit comments