Skip to content

Commit a7cf595

Browse files
committed
feat: default config
1 parent b3cc08f commit a7cf595

35 files changed

+576
-308
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.ts linguist-language=typescript
2+
*.vue linguist-language=vue

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Awen <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+75-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Go Captcha Vue Package
22

3+
## Install
34
##
45
```shell
56
# Greater than or equal to vue2.7.14 and less than vue3.0
@@ -42,31 +43,33 @@ Vue.use(GoCaptcha)
4243
/>
4344
```
4445

45-
### params
46+
### Parameter Reference
4647
```ts
4748
// config = {}
48-
interface Config {
49+
interface ClickConfig {
4950
width?: number;
5051
height?: number;
5152
thumbWidth?: number;
5253
thumbHeight?: number;
5354
verticalPadding?: number;
5455
horizontalPadding?: number;
5556
showTheme?: boolean;
57+
title?: string;
58+
buttonText?: string;
5659
}
5760

5861
// data = {}
59-
interface Data {
62+
interface ClickData {
6063
image: string;
6164
thumb: string;
6265
}
6366

6467
// events = {}
65-
interface Events {
68+
interface ClickEvents {
6669
click?: (x: number, y: number) => void;
6770
refresh?: () => void;
6871
close?: () => void;
69-
confirm?: (dots: Array<CaptchaDot>) => boolean;
72+
confirm?: (dots: Array<ClickDot>) => boolean;
7073
}
7174
```
7275

@@ -84,21 +87,22 @@ interface Events {
8487
:events="{}"
8588
/>
8689
```
87-
### params
90+
### Parameter Reference
8891
```ts
8992
// config = {}
90-
interface Config {
93+
interface SlideConfig {
9194
width?: number;
9295
height?: number;
9396
thumbWidth?: number;
9497
thumbHeight?: number;
9598
verticalPadding?: number;
9699
horizontalPadding?: number;
97100
showTheme?: boolean;
101+
title?: string;
98102
}
99103

100104
// data = {}
101-
interface Data {
105+
interface SlideData {
102106
thumbX: number;
103107
thumbY: number;
104108
thumbWidth: number;
@@ -108,14 +112,44 @@ interface Data {
108112
}
109113

110114
// events = {}
111-
interface Events {
115+
interface SlideEvents {
112116
move?: (x: number, y: number) => void;
113117
refresh?: () => void;
114118
close?: () => void;
115-
confirm?: (point: CaptchaPoint) => boolean;
119+
confirm?: (point: SlidePoint) => boolean;
116120
}
117121
```
122+
```ts
123+
// config = {}
124+
interface SlideRegionConfig {
125+
width?: number;
126+
height?: number;
127+
thumbWidth?: number;
128+
thumbHeight?: number;
129+
verticalPadding?: number;
130+
horizontalPadding?: number;
131+
showTheme?: boolean;
132+
title?: string;
133+
}
118134

135+
// data = {}
136+
interface SlideRegionData {
137+
thumbX: number;
138+
thumbY: number;
139+
thumbWidth: number;
140+
thumbHeight: number;
141+
image: string;
142+
thumb: string;
143+
}
144+
145+
// events = {}
146+
interface SlideRegionEvents {
147+
move?: (x: number, y: number) => void;
148+
refresh?: () => void;
149+
close?: () => void;
150+
confirm?: (point: SlideRegionPoint) => boolean;
151+
}
152+
```
119153

120154
## 🖖 Rotate Mode Captcha
121155
```vue
@@ -126,31 +160,57 @@ interface Events {
126160
/>
127161
```
128162

129-
### params
163+
### Parameter Reference
130164
```ts
131165
// config = {}
132-
interface Config {
166+
interface RotateConfig {
133167
width?: number;
134168
height?: number;
135169
thumbWidth?: number;
136170
thumbHeight?: number;
137171
verticalPadding?: number;
138172
horizontalPadding?: number;
139173
showTheme?: boolean;
174+
title?: string;
140175
}
141176

142177
// data = {}
143-
interface Data {
178+
interface RotateData {
144179
angle: number;
145180
image: string;
146181
thumb: string;
147182
}
148183

149184
// events = {}
150-
interface Events {
185+
interface RotateEvents {
151186
rotate?: (angle: number) => void;
152187
refresh?: () => void;
153188
close?: () => void;
154189
confirm?: (angle: number) => boolean;
155190
}
156-
```
191+
```
192+
193+
194+
## Button
195+
```vue
196+
<gocaptcha-button />
197+
```
198+
199+
### params
200+
```ts
201+
interface _ {
202+
config?: ButtonConfig;
203+
clickEvent?: () => void;
204+
disabled?: boolean;
205+
type?: "default" | "warn" | "error" | "success";
206+
title?: string;
207+
}
208+
209+
export interface ButtonConfig {
210+
width?: number;
211+
height?: number;
212+
verticalPadding?: number;
213+
horizontalPadding?: number;
214+
}
215+
216+
```

example/App.vue

+9-1
Large diffs are not rendered by default.

package.json

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"private": false,
55
"type": "module",
66
"license": "MIT",
7+
"email": "[email protected]",
8+
"author": "Awen <[email protected]>",
79
"description": "This is the vue package for go-captcha",
810
"keywords": [
911
"go-captcha-vue",
@@ -24,6 +26,7 @@
2426
"type": "git",
2527
"url": "git+https://github.com/wenlng/go-captcha-vue.git"
2628
},
29+
"homepage": "https://github.com/wenlng/go-captcha-vue",
2730
"main": "dist/go-captcha-vue.umd.js",
2831
"module": "dist/go-captcha-vue.es.js",
2932
"types": "./dist/index.d.ts",
@@ -40,13 +43,17 @@
4043
"preview": "vite preview --port 5050",
4144
"type-check": "vue-tsc --noEmit -p tsconfig.json"
4245
},
46+
"peerDependencies": {
47+
"vue": ">=3"
48+
},
4349
"dependencies": {
4450
"vue": "^3.0.1"
4551
},
4652
"devDependencies": {
4753
"@types/node": "^16.11.10",
4854
"@vitejs/plugin-vue": "4.4.0",
4955
"@vitejs/plugin-vue-jsx": "^3.1.0",
56+
"autoprefixer": "^10.4.19",
5057
"fast-glob": "^3.3.2",
5158
"less": "^4.2.0",
5259
"less-loader": "^12.2.0",

packages/assets/icons/loading-icon.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="84" height="84" v-bind="$attrs" @click="emitClickEvent">
3-
<circle cx="50" cy="36.8101" r="10" fill="#3e7cff">
3+
<circle cx="50" cy="36.8101" r="10">
44
<animate attributeName="cy" dur="1s" repeatCount="indefinite" calcMode="spline" keySplines="0.45 0 0.9 0.55;0 0.45 0.55 0.9" keyTimes="0;0.5;1" values="23;77;23"></animate>
55
</circle>
66
</svg>

packages/components/button/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/**
2+
* @Author Awen
3+
* @Date 2024/06/01
4+
5+
**/
6+
17
import capt from './index.vue'
28

39
// @ts-ignore

0 commit comments

Comments
 (0)