go-captcha-vue 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -63
- package/dist/components/rotate/meta/data.d.ts +1 -0
- package/dist/go-captcha-vue.es.js +650 -2209
- package/dist/go-captcha-vue.umd.js +8 -24
- package/dist/style.css +1 -1
- package/package.json +6 -8
package/README.md
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
@@ -29,27 +40,44 @@ npm install go-captcha-vue@^2
|
|
|
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
|
-
|
|
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
|
-
|
|
77
|
+
|
|
50
78
|
```ts
|
|
51
79
|
// config = {}
|
|
52
|
-
interface
|
|
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
|
|
95
|
+
interface Data {
|
|
68
96
|
image: string;
|
|
69
97
|
thumb: string;
|
|
70
98
|
}
|
|
71
99
|
|
|
72
100
|
// events = {}
|
|
73
|
-
interface
|
|
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) =>
|
|
105
|
+
confirm?: (dots: Array<ClickDot>, reset:() => void) => boolean;
|
|
78
106
|
}
|
|
79
107
|
|
|
80
|
-
// component
|
|
81
|
-
interface
|
|
82
|
-
reset:
|
|
83
|
-
clear:
|
|
84
|
-
refresh:
|
|
85
|
-
close:
|
|
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
|
-
##
|
|
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
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
126
|
+
<script>
|
|
127
|
+
// call methods
|
|
128
|
+
const domRef = ref(null)
|
|
129
|
+
domRef.value.clear()
|
|
130
|
+
domRef.value.refresh()
|
|
131
|
+
</script>
|
|
102
132
|
```
|
|
103
|
-
|
|
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) =>
|
|
165
|
+
confirm?: (point: SlidePoint, reset:() => void) => boolean;
|
|
134
166
|
}
|
|
135
167
|
|
|
136
|
-
// component
|
|
137
|
-
interface
|
|
138
|
-
reset:
|
|
139
|
-
clear:
|
|
140
|
-
refresh:
|
|
141
|
-
close:
|
|
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) =>
|
|
225
|
+
confirm?: (point: SlideRegionPoint, reset:() => void) => boolean;
|
|
174
226
|
}
|
|
175
227
|
|
|
176
|
-
// component
|
|
177
|
-
interface
|
|
178
|
-
reset:
|
|
179
|
-
clear:
|
|
180
|
-
refresh:
|
|
181
|
-
close:
|
|
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
|
-
##
|
|
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
|
-
|
|
254
|
+
|
|
195
255
|
```ts
|
|
196
256
|
// config = {}
|
|
197
|
-
interface
|
|
257
|
+
interface Config {
|
|
198
258
|
width?: number;
|
|
199
259
|
height?: number;
|
|
200
260
|
thumbWidth?: number;
|
|
@@ -203,40 +263,43 @@ 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
|
|
271
|
+
interface Data {
|
|
211
272
|
angle: number;
|
|
212
273
|
image: string;
|
|
213
274
|
thumb: string;
|
|
275
|
+
thumbSize: number;
|
|
214
276
|
}
|
|
215
277
|
|
|
216
278
|
// events = {}
|
|
217
|
-
interface
|
|
279
|
+
interface Events {
|
|
218
280
|
rotate?: (angle: number) => void;
|
|
219
281
|
refresh?: () => void;
|
|
220
282
|
close?: () => void;
|
|
221
|
-
confirm?: (angle: number, reset:() => void) =>
|
|
283
|
+
confirm?: (angle: number, reset:() => void) => boolean;
|
|
222
284
|
}
|
|
223
285
|
|
|
224
|
-
// component
|
|
225
|
-
interface
|
|
226
|
-
reset:
|
|
227
|
-
clear:
|
|
228
|
-
refresh:
|
|
229
|
-
close:
|
|
286
|
+
// export component method
|
|
287
|
+
interface ExportMethods {
|
|
288
|
+
reset: () => void,
|
|
289
|
+
clear: () => void,
|
|
290
|
+
refresh: () => void,
|
|
291
|
+
close: () => void,
|
|
230
292
|
}
|
|
231
293
|
```
|
|
232
294
|
|
|
233
295
|
|
|
296
|
+
|
|
234
297
|
## Button
|
|
235
298
|
```vue
|
|
236
299
|
<gocaptcha-button @clickEvent="() => console.log('hello')"/>
|
|
237
300
|
```
|
|
238
301
|
|
|
239
|
-
|
|
302
|
+
|
|
240
303
|
```ts
|
|
241
304
|
interface $Attr {
|
|
242
305
|
config?: CaptchaConfig;
|
|
@@ -249,19 +312,10 @@ interface $Event {
|
|
|
249
312
|
clickEvent?: ()=>void; // event -> @clickEvent=""
|
|
250
313
|
}
|
|
251
314
|
|
|
252
|
-
export interface
|
|
315
|
+
export interface CaptchaConfig {
|
|
253
316
|
width?: number;
|
|
254
317
|
height?: number;
|
|
255
318
|
verticalPadding?: number;
|
|
256
319
|
horizontalPadding?: number;
|
|
257
320
|
}
|
|
258
|
-
|
|
259
321
|
```
|
|
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/>
|