更新记录
1.0.2(2025-02-17) 下载此版本
兼容小程序、快应用
1.0.1(2025-02-16) 下载此版本
发布提交正式代码
1.0.0(2025-02-16) 下载此版本
1、首次发布,提交测试
查看更多平台兼容性
Vue2 | Vue3 |
---|---|
× | √ |
App | 快应用 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|
HBuilderX 3.91 app-vue app-nvue | √ | √ | √ | √ | √ | √ |
钉钉小程序 | 快手小程序 | 飞书小程序 | 京东小程序 | 鸿蒙元服务 |
---|---|---|---|---|
√ | √ | √ | √ | × |
H5-Safari | Android Browser | 微信浏览器(Android) | QQ浏览器(Android) | Chrome | IE | Edge | Firefox | PC-Safari |
---|---|---|---|---|---|---|---|---|
√ | √ | √ | √ | √ | √ | √ | √ | √ |
Go Captcha
UniApp 行为验证码
English | 中文
⭐️ 如果能帮助到你,请随手给点一个star
QQ交流群:178498936

- GoCaptcha:https://github.com/wenlng/go-captcha
- GoCaptcha 文档:http://gocaptcha.wencodes.com
- Golang 内嵌素材资源:https://github.com/wenlng/go-captcha-assets
- Golang/前端的实例:https://github.com/wenlng/go-captcha-example
- 在线演示 URL:http://gocaptcha.wencodes.com/demo/
- Javascript 原生库:https://github.com/wenlng/go-captcha-jslib
- Vue Package:https://github.com/wenlng/go-captcha-vue
- React Package:https://github.com/wenlng/go-captcha-react
- Angular Package:https://github.com/wenlng/go-captcha-angular
- Svelte Package:https://github.com/wenlng/go-captcha-svelte
- Solid Package:https://github.com/wenlng/go-captcha-solid
- UniApp Module:https://github.com/wenlng/go-captcha-uni
- ...
HBuilderX Version | Vue Version | Go Captcha Version |
---|---|---|
HBuilderX >= 3.0 | vue >= 3.0 | go-captcha-uni@^1 |
安装方式
1、使用HBuilderX导入插件
2、下载插件ZIP导入插件
3、Node 依赖工具安装
yarn add go-captcha-uni
# or
npm install go-captcha-uni
# or
pnpm install go-captcha-uni
使用
- 采用 uni_modules 方式安装,支持 easycom 模式导入组件,可以不用 Import、注册等。
<template>
<go-captcha-uni type="click"
:data="clickCaptData"
:events="clickCaptEvents"
:config="clickCaptConfig"
:theme="clickThemeColor" />
</template>
- 采用 npm/yarn/pnpm/... 等依赖工具方式安装,需要 Import 导入。
<template> <go-captcha-uni type="click" :data="clickCaptData" :events="clickCaptEvents" :config="clickCaptConfig" :theme="clickThemeColor" /> </template>
## 点选式
```vue
<go-captcha-uni
type="click"
:config="{}"
:theme="{}"
:data="{}"
:events="{}"
ref="domRef"
/>
<script>
// call methods
const domRef = ref(null)
domRef.value.clear()
domRef.value.refresh()
</script>
// config = {}
interface Config {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
buttonText?: string;
iconSize?: number;
dotSize?: number;
}
// theme = {}
interface Theme {
textColor?: string; // '#ffffff'
bgColor?: string;
btnColor?: string;
btnDisabledColor?: string;
btnBgColor?: string;
btnBorderColor?: string;
activeColor?: string;
borderColor?: string;
iconColor?: string;
loadingIconColor?: string;
bodyBgColor?: string;
dotColor?: string;
dotBgColor?: string;
dotBorderColor?: string;
}
// data = {}
interface Data {
image: string;
thumb: string;
}
// events = {}
interface Events {
click?: (x: number, y: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (dots: Array<ClickDot>, reset:() => void) => boolean;
}
// export component method
interface ExportMethods {
reset: () => void,
clear: () => void,
refresh: () => void,
close: () => void,
}
滑动式
<go-captcha-uni
type="slide"
:config="{}"
:theme="{}"
:data="{}"
:events="{}"
ref="domRef"
/>
<script>
// call methods
const domRef = ref(null)
domRef.value.clear()
domRef.value.refresh()
</script>
// config = {}
interface SlideConfig {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
iconSize?: number;
scope ?: boolean;
}
// theme = {}
interface Theme {
textColor?: string; // '#ffffff'
bgColor?: string;
borderColor?: string;
iconColor?: string;
dragBarColor?: string;
dragBgColor?: string;
dragIconColor?: string;
loadingIconColor?: string;
bodyBgColor?: string;
}
// data = {}
interface SlideData {
thumbX: number;
thumbY: number;
thumbWidth: number;
thumbHeight: number;
image: string;
thumb: string;
}
// events = {}
interface SlideEvents {
move?: (x: number, y: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (point: SlidePoint, reset:() => void) => boolean;
}
// export component method
interface ExportMethods {
reset: () => void,
clear: () => void,
refresh: () => void,
close: () => void,
}
拖拽式
<go-captcha-uni
type="drag"
:config="{}"
:theme="{}"
:data="{}"
:events="{}"
ref="domRef"
/>
<script>
// call methods
const domRef = ref(null)
domRef.value.clear()
domRef.value.refresh()
</script>
// config = {}
interface DragConfig {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
iconSize?: number;
scope ?: boolean;
}
// theme = {}
interface Theme {
textColor?: string; // '#ffffff'
bgColor?: string;
borderColor?: string;
iconColor?: string;
loadingIconColor?: string;
bodyBgColor?: string;
}
// data = {}
interface DragData {
thumbX: number;
thumbY: number;
thumbWidth: number;
thumbHeight: number;
image: string;
thumb: string;
}
// events = {}
interface DragEvents {
move?: (x: number, y: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (point: SlideRegionPoint, reset:() => void) => boolean;
}
// export component method
interface ExportMethods {
reset: () => void,
clear: () => void,
refresh: () => void,
close: () => void,
}
旋转式
<go-captcha-uni
type="rotate"
:config="{}"
:theme="{}"
:data="{}"
:events="{}"
ref="domRef"
/>
<script>
// call methods
const domRef = ref(null)
domRef.value.clear()
domRef.value.refresh()
</script>
// config = {}
interface Config {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
iconSize?: number;
scope ?: boolean;
}
// theme = {}
interface Theme {
textColor?: string; // '#ffffff'
bgColor?: string;
borderColor?: string;
iconColor?: string;
dragBarColor?: string;
dragBgColor?: string;
dragIconColor?: string;
roundColor?: string;
loadingIconColor?: string;
bodyBgColor?: string;
}
// data = {}
interface Data {
angle: number;
image: string;
thumb: string;
}
// events = {}
interface Events {
rotate?: (angle: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (angle: number, reset:() => void) => boolean;
}
// export component method
interface ExportMethods {
reset: () => void,
clear: () => void,
refresh: () => void,
close: () => void,
}
按钮
<go-captcha-uni
type="button"
:config="{}"
:theme="{}"
:data="{}"
:events="{}"
/>
// config = {}
interface Config {
width?: number;
height?: number;
verticalPadding?: number;
horizontalPadding?: number;
}
// theme = {}
interface Theme {
textColor?: string; // '#ffffff'
bgColor?: string;
btnColor?: string;
btnDisabledColor?: string;
btnBgColor?: string;
btnBorderColor?: string;
activeColor?: string;
borderColor?: string;
iconColor?: string;
loadingIconColor?: string;
bodyBgColor?: string;
dotColor?: string;
dotBgColor?: string;
dotBorderColor?: string;
}
// data = {}
interface Data {
disabled?: boolean;
type?: "default" | "warn" | "error" | "success"
}
// events = {}
interface Events {
click?: () => {}
}