Skip to content

Commit 6d789bf

Browse files
committed
update README.md
1 parent a871b8b commit 6d789bf

File tree

9 files changed

+587
-91
lines changed

9 files changed

+587
-91
lines changed

README.md

+116-63
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,83 @@
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>
25

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>
57

8+
<br/>
9+
10+
> English | [中文](README_zh.md)
611
712
<br/>
813

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+
919
| Vue Version | Go Captcha Version |
1020
|:-----------------------|:------------------:|
1121
| vue >= 2.7.14 && < 3.0 | go-captcha-vue@^1 |
1222
| vue >= 3.0 | go-captcha-vue@^2 |
1323

1424
## Install
25+
Greater than or equal to vue2.7.14 and less than vue3.0
1526
```shell
16-
# Greater than or equal to vue2.7.14 and less than vue3.0
1727
yarn add go-captcha-vue@^1
1828
# or
1929
npm install go-captcha-vue@^1
2030
# or
2131
pnpm install go-captcha-vue@^1
32+
```
2233

23-
############################################
24-
# Greater than vue3.0
34+
Greater than vue3.0
35+
```shell
2536
yarn add go-captcha-vue@^2
2637
# or
2738
npm install go-captcha-vue@^2
2839
# or
2940
pnpm install go-captcha-vue@^2
3041
```
3142

32-
Use Go Captcha
43+
## Use Go Captcha
3344
```ts
3445
import "go-captcha-vue/dist/style.css"
3546
import GoCaptcha from "go-captcha-vue"
3647

3748
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)
3857
```
3958

40-
## 🖖 Click Mode Captcha
59+
60+
## Click Mode
4161
```vue
4262
<gocaptcha-click
4363
:config="{}"
4464
:data="{}"
4565
:events="{}"
66+
ref="domRef"
4667
/>
68+
69+
<script>
70+
// call methods
71+
const domRef = ref(null)
72+
domRef.value.clear()
73+
domRef.value.refresh()
74+
</script>
4775
```
4876

49-
### Parameter Reference
77+
5078
```ts
5179
// config = {}
52-
interface ClickConfig {
80+
interface Config {
5381
width?: number;
5482
height?: number;
5583
thumbWidth?: number;
@@ -64,43 +92,46 @@ interface ClickConfig {
6492
}
6593

6694
// data = {}
67-
interface ClickData {
95+
interface Data {
6896
image: string;
6997
thumb: string;
7098
}
7199

72100
// events = {}
73-
interface ClickEvents {
101+
interface Events {
74102
click?: (x: number, y: number) => void;
75103
refresh?: () => void;
76104
close?: () => void;
77-
confirm?: (dots: Array<ClickDot>, reset:() => void) => void;
105+
confirm?: (dots: Array<ClickDot>, reset:() => void) => boolean;
78106
}
79107

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,
86114
}
87115
```
88116

89-
## 🖖 Slide Mode Captcha
117+
## Slide Mode
90118
```vue
91119
<gocaptcha-slide
92120
:config="{}"
93121
:data="{}"
94122
:events="{}"
123+
ref="domRef"
95124
/>
96125
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>
102132
```
103-
### Parameter Reference
133+
134+
104135
```ts
105136
// config = {}
106137
interface SlideConfig {
@@ -112,6 +143,7 @@ interface SlideConfig {
112143
horizontalPadding?: number;
113144
showTheme?: boolean;
114145
title?: string;
146+
iconSize?: number;
115147
scope ?: boolean;
116148
}
117149

@@ -130,17 +162,36 @@ interface SlideEvents {
130162
move?: (x: number, y: number) => void;
131163
refresh?: () => void;
132164
close?: () => void;
133-
confirm?: (point: SlidePoint, reset:() => void) => void;
165+
confirm?: (point: SlidePoint, reset:() => void) => boolean;
134166
}
135167

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,
142174
}
143175
```
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+
144195
```ts
145196
// config = {}
146197
interface SlideRegionConfig {
@@ -152,6 +203,7 @@ interface SlideRegionConfig {
152203
horizontalPadding?: number;
153204
showTheme?: boolean;
154205
title?: string;
206+
iconSize?: number;
155207
scope ?: boolean;
156208
}
157209

@@ -170,31 +222,39 @@ interface SlideRegionEvents {
170222
move?: (x: number, y: number) => void;
171223
refresh?: () => void;
172224
close?: () => void;
173-
confirm?: (point: SlideRegionPoint, reset:() => void) => void;
225+
confirm?: (point: SlideRegionPoint, reset:() => void) => boolean;
174226
}
175227

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,
182234
}
183235
```
184236

185-
## 🖖 Rotate Mode Captcha
237+
## Rotation Mode
186238
```vue
187239
<gocaptcha-rotate
188240
:config="{}"
189241
:data="{}"
190242
:events="{}"
243+
ref="domRef"
191244
/>
245+
246+
<script>
247+
// call methods
248+
const domRef = ref(null)
249+
domRef.value.clear()
250+
domRef.value.refresh()
251+
</script>
192252
```
193253

194-
### Parameter Reference
254+
195255
```ts
196256
// config = {}
197-
interface RotateConfig {
257+
interface Config {
198258
width?: number;
199259
height?: number;
200260
thumbWidth?: number;
@@ -203,40 +263,42 @@ interface RotateConfig {
203263
horizontalPadding?: number;
204264
showTheme?: boolean;
205265
title?: string;
266+
iconSize?: number;
206267
scope ?: boolean;
207268
}
208269

209270
// data = {}
210-
interface RotateData {
271+
interface Data {
211272
angle: number;
212273
image: string;
213274
thumb: string;
214275
}
215276

216277
// events = {}
217-
interface RotateEvents {
278+
interface Events {
218279
rotate?: (angle: number) => void;
219280
refresh?: () => void;
220281
close?: () => void;
221-
confirm?: (angle: number, reset:() => void) => void;
282+
confirm?: (angle: number, reset:() => void) => boolean;
222283
}
223284

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,
230291
}
231292
```
232293

233294

295+
234296
## Button
235297
```vue
236298
<gocaptcha-button @clickEvent="() => console.log('hello')"/>
237299
```
238300

239-
### params
301+
240302
```ts
241303
interface $Attr {
242304
config?: CaptchaConfig;
@@ -249,19 +311,10 @@ interface $Event {
249311
clickEvent?: ()=>void; // event -> @clickEvent=""
250312
}
251313

252-
export interface ButtonConfig {
314+
export interface CaptchaConfig {
253315
width?: number;
254316
height?: number;
255317
verticalPadding?: number;
256318
horizontalPadding?: number;
257319
}
258-
259320
```
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

Comments
 (0)