更新记录

1.0.5(2025-02-27) 下载此版本

兼容vue2,改进 @event 事件传递

1.0.4(2025-02-26) 下载此版本

兼容vue2

1.0.3(2025-02-26) 下载此版本

兼容vue2

查看更多

平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.91 app-vue
钉钉小程序 快手小程序 飞书小程序 京东小程序 鸿蒙元服务
×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari

Go Captcha

UniApp 行为验证码


English | 中文


⭐️ 如果能帮助到你,请随手给点一个star

QQ交流群:178498936

Poster




链接索引

项目名称 说明
document GoCaptcha 文档
online demo GoCaptcha 在线演示
go-captcha-example Golang + 前端 + APP实例
go-captcha-assets Golang 内嵌素材资源
go-captcha Golang 验证码
go-captcha-jslib Javascript 验证码
go-captcha-vue Vue 验证码
go-captcha-react React 验证码
go-captcha-angular Angular 验证码
go-captcha-svelte Svelte 验证码
go-captcha-solid Solid 验证码
go-captcha-uni UniApp 验证码,兼容 Android、IOS、小程序、快应用等
...


安装方式

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"
                   :config="clickCaptConfig"
                   :theme="clickThemeColor"
                   @event-click="clickEvents"
                   @event-confirm="confirmEvents"
                   @event-refresh="refreshEvents"
                   @event-close="closeEvents"/>
</template>
  • 采用 npm/yarn/pnpm/... 等依赖工具方式安装,需要 Import 导入。
<template>
  <go-captcha-uni  type="click"
                   :data="clickCaptData"
                   :config="clickCaptConfig"
                   :theme="clickThemeColor"
                   @event-click="clickEvents"
                   @event-confirm="confirmEvents"
                   @event-refresh="refreshEvents"
                   @event-close="closeEvents"/>
</template>

<script>
import GoCaptchaUni from 'go-captcha-uni'
</script>

点选式

<go-captcha-uni
    type="click"
    :config="{}"
    :theme="{}"
    :data="{}"
    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;
}

// data = {}
interface Data {
  image: string;
  thumb: string;
}

// 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;
}

// @events
interface _ {
  '@event-click'?: (x: number, y: number) => void;
  '@event-refresh'?: () => void;
  '@event-close'?: () => void;
  '@event-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="{}"
    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;
}

// data = {}
interface Data {
  thumbX: number;
  thumbY: number;
  thumbWidth: number;
  thumbHeight: number;
  image: string;
  thumb: string;
}

// theme = {}
interface Theme {
  textColor?: string; // '#ffffff'
  bgColor?: string;
  borderColor?: string;
  iconColor?: string;
  dragBarColor?: string;
  dragBgColor?: string;
  dragIconColor?: string;
  loadingIconColor?: string;
  bodyBgColor?: string;
}

// @events
interface _{
  '@evennt-move'?: (x: number, y: number) => void;
  '@evennt-refresh'?: () => void;
  '@evennt-close'?: () => void;
  '@evennt-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="{}"
    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;
}

// data = {}
interface Data {
  thumbX: number;
  thumbY: number;
  thumbWidth: number;
  thumbHeight: number;
  image: string;
  thumb: string;
}

// theme = {}
interface Theme {
  textColor?: string; // '#ffffff'
  bgColor?: string;
  borderColor?: string;
  iconColor?: string;
  loadingIconColor?: string;
  bodyBgColor?: string;
}

// @events
interface _ {
  '@event-move'?: (x: number, y: number) => void;
  '@event-refresh'?: () => void;
  '@event-close'?: () => void;
  '@event-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="{}"
    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;
}

// data = {}
interface Data {
  angle: number;
  image: string;
  thumb: string;
}
// theme = {}
interface Theme {
  textColor?: string; // '#ffffff'
  bgColor?: string;
  borderColor?: string;
  iconColor?: string;
  dragBarColor?: string;
  dragBgColor?: string;
  dragIconColor?: string;
  roundColor?: string;
  loadingIconColor?: string;
  bodyBgColor?: string;
}

// @events
interface _ {
  '@event-rotate'?: (angle: number) => void;
  '@event-refresh'?: () => void;
  '@event-close'?: () => void;
  '@event-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="{}"
/>
// config = {}
interface Config {
  width?: number;
  height?: number;
  verticalPadding?: number;
  horizontalPadding?: number;
}

// data = {}
interface Data {
  disabled?: boolean;
  type?: "default" | "warn" | "error" | "success"
}

// 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;
}

// @events
interface _ {
  '@event-click'?: () => {}
}

👍 赞助一下


隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问