Commit 37e0f03c authored by 郑磊's avatar 郑磊

更新说明文档

parent fca3118a
...@@ -36,9 +36,54 @@ https://captcha.service.briefmsg.cn/?lang=xxxx&bg=%23ff0000&shadow=1&radius=1&ex ...@@ -36,9 +36,54 @@ https://captcha.service.briefmsg.cn/?lang=xxxx&bg=%23ff0000&shadow=1&radius=1&ex
1. 引入npm库 1. 引入npm库
```shell ```shell
npm i git+http://gitlab.3yakj.com/crystalray/fj-captcha-service.git/vue npm i git+http://gitlab.3yakj.com/crystalray/fj-captcha-vue.git
``` ```
2. 在入口文件中引用样式
```javascript
import 'fj-captcha-vue/esm/style.css'
```
3. 引入组件
```javascript
import { Captcha } from 'fj-captcha-vue'
```
```
<Captcha
:requestCaptchaDataUrl="requestCaptchaDataUrl"
:validCaptchaUrl="validCaptchaUrl"
:showClose="showClose"
:locale="locale"
:extra="extra"
@close="onClose"
@success="onSuccess"
/>
```
属性说明
| 属性名 | 类型 | 必需 | 说明 |
| --------------------- | ------ | ---- | --------------------------------------------------------------------------------- |
| requestCaptchaDataUrl | string | 是 | 获取验证码的数据的地址 `https://captcha.service.briefmsg.cn/api/captcha/generate` |
| validCaptchaUrl | string | 是 | 校验验证码数据的地址 `https://captcha.service.briefmsg.cn/api/captcha/check` |
| showClose | bool | 否 | 是否显示关闭按钮,默认为`false` |
| locale | string | 否 | 显示的语言,支持`zh-CN`,`zh-TW`,`en`,不传则自动根据浏览器环境获取 |
| extra | object | 否 | 额外校验数据,用于服务端校验信息的合法性 |
事件说明
| 事件名 | 参数签名 | 说明 |
| ------- | --------------------- | ---------------------------- |
| close | 无 | 用户点击关闭按钮时触发的事件 |
| success | (key: string) => void | 当验证码校验完成时触发的事件 |
### React
正在开发中...
## 服务端接入 ## 服务端接入
当前端收到验证完成事件,收到了验证标识之后,可以传递给服务端,由服务端调用验证服务进行数据校验,校验通过后即可执行自身的业务逻辑。 当前端收到验证完成事件,收到了验证标识之后,可以传递给服务端,由服务端调用验证服务进行数据校验,校验通过后即可执行自身的业务逻辑。
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment