Skip to content

点选文字验证码

200+ 中文词汇支持。每个词汇不含重复字,随机插入迷惑文字,提示图片防止机器识别。

示例

javascript
import { ClickCaptcha } from '@captcha-pro/core'

const captcha = new ClickCaptcha({
  el: '#click-captcha',
  width: 300,
  height: 170,
  count: 3,
  onSuccess: () => console.log('验证通过!')
})

const points = captcha.getClickPoints()

选项

参数类型默认值描述
elstring | HTMLElement-容器元素或选择器
widthnumber300容器宽度
heightnumber170容器高度
countnumber3点击点数量
showRefreshbooleantrue显示刷新按钮
classNamestring'captcha-click'自定义类名
verifyMode'frontend' | 'backend''frontend'验证模式
backendVerifyBackendVerifyOptions-后端验证配置
securitySecurityOptions-安全选项
onSuccess() => void-验证成功回调
onFail() => void-验证失败回调
onRefresh() => void-刷新回调

BackendVerifyOptionsSecurityOptions 详见 API 选项

实例方法

方法描述
verify(data)手动验证
reset()重置验证码状态
refresh()生成新的验证码
destroy()销毁验证码实例
getClickPoints()获取已点击的点位
getSignedData()获取带签名的数据用于后端验证
getStatistics()获取验证统计
resetStatistics()重置统计数据

基于 MIT 许可发布。