Skip to content

Commit 156ba27

Browse files
committed
update README.md
1 parent 791a9b8 commit 156ba27

File tree

9 files changed

+977
-678
lines changed

9 files changed

+977
-678
lines changed

README.md

Lines changed: 95 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +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>
5+
6+
</div>
7+
8+
<br/>
9+
10+
> English | [中文](README_zh.md)
211
312
<br/>
413

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+
519
| Vue Version | Go Captcha Version |
620
|:-----------------------|:------------------:|
721
| vue >= 2.7.14 && < 3.0 | go-captcha-vue@^1 |
822
| vue >= 3.0 | go-captcha-vue@^2 |
923

1024
## Install
25+
Greater than or equal to vue2.7.14 and less than vue3.0
1126
```shell
12-
# Greater than or equal to vue2.7.14 and less than vue3.0
1327
yarn add go-captcha-vue@^1
1428
# or
1529
npm install go-captcha-vue@^1
1630
# or
1731
pnpm install go-captcha-vue@^1
32+
```
1833

19-
############################################
20-
# Greater than vue3.0
34+
Greater than vue3.0
35+
```shell
2136
yarn add go-captcha-vue@^2
2237
# or
2338
npm install go-captcha-vue@^2
2439
# or
2540
pnpm install go-captcha-vue@^2
2641
```
2742

28-
Use Go Captcha
43+
## Use Go Captcha
2944
```ts
3045
import "go-captcha-vue/dist/style.css"
3146
import GoCaptcha from "go-captcha-vue"
3247

3348
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)
3457
```
3558

36-
## 🖖 Click Mode Captcha
59+
60+
## Click Mode
3761
```vue
3862
<gocaptcha-click
3963
:config="{}"
4064
:data="{}"
4165
:events="{}"
66+
ref="domRef"
4267
/>
68+
69+
<script>
70+
// call methods
71+
const domRef = ref(null)
72+
domRef.value.clear()
73+
domRef.value.refresh()
74+
</script>
4375
```
4476

45-
### Parameter Reference
77+
4678
```ts
4779
// config = {}
48-
interface ClickConfig {
80+
interface Config {
4981
width?: number;
5082
height?: number;
5183
thumbWidth?: number;
@@ -60,43 +92,46 @@ interface ClickConfig {
6092
}
6193

6294
// data = {}
63-
interface ClickData {
95+
interface Data {
6496
image: string;
6597
thumb: string;
6698
}
6799

68100
// events = {}
69-
interface ClickEvents {
101+
interface Events {
70102
click?: (x: number, y: number) => void;
71103
refresh?: () => void;
72104
close?: () => void;
73105
confirm?: (dots: Array<ClickDot>, reset:() => void) => boolean;
74106
}
75107

76-
// component method
77-
interface ClickExpose {
108+
// export component method
109+
interface ExportMethods {
78110
reset: () => void,
79111
clear: () => void,
80112
refresh: () => void,
81113
close: () => void,
82114
}
83115
```
84116

85-
## 🖖 Slide Mode Captcha
117+
## Slide Mode
86118
```vue
87119
<gocaptcha-slide
88120
:config="{}"
89121
:data="{}"
90122
:events="{}"
123+
ref="domRef"
91124
/>
92125
93-
<gocaptcha-slide-region
94-
:config="{}"
95-
:data="{}"
96-
:events="{}"
97-
/>
126+
<script>
127+
// call methods
128+
const domRef = ref(null)
129+
domRef.value.clear()
130+
domRef.value.refresh()
131+
</script>
98132
```
99-
### Parameter Reference
133+
134+
100135
```ts
101136
// config = {}
102137
interface SlideConfig {
@@ -130,14 +165,33 @@ interface SlideEvents {
130165
confirm?: (point: SlidePoint, reset:() => void) => boolean;
131166
}
132167

133-
// component method
134-
interface SlideExpose {
168+
// export component method
169+
interface ExportMethods {
135170
reset: () => void,
136171
clear: () => void,
137172
refresh: () => void,
138173
close: () => void,
139174
}
140175
```
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+
141195
```ts
142196
// config = {}
143197
interface SlideRegionConfig {
@@ -171,29 +225,36 @@ interface SlideRegionEvents {
171225
confirm?: (point: SlideRegionPoint, reset:() => void) => boolean;
172226
}
173227

174-
175-
// component method
176-
interface SlideRegionExpose {
228+
// export component method
229+
interface ExportMethods {
177230
reset: () => void,
178231
clear: () => void,
179232
refresh: () => void,
180233
close: () => void,
181234
}
182235
```
183236

184-
## 🖖 Rotate Mode Captcha
237+
## Rotation Mode
185238
```vue
186239
<gocaptcha-rotate
187240
:config="{}"
188241
:data="{}"
189242
:events="{}"
243+
ref="domRef"
190244
/>
245+
246+
<script>
247+
// call methods
248+
const domRef = ref(null)
249+
domRef.value.clear()
250+
domRef.value.refresh()
251+
</script>
191252
```
192253

193-
### Parameter Reference
254+
194255
```ts
195256
// config = {}
196-
interface RotateConfig {
257+
interface Config {
197258
width?: number;
198259
height?: number;
199260
thumbWidth?: number;
@@ -207,22 +268,22 @@ interface RotateConfig {
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;
221282
confirm?: (angle: number, reset:() => void) => boolean;
222283
}
223284

224-
// component method
225-
interface RotateExpose {
285+
// export component method
286+
interface ExportMethods {
226287
reset: () => void,
227288
clear: () => void,
228289
refresh: () => void,
@@ -231,12 +292,13 @@ interface RotateExpose {
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)