Solid Package
安装
shell
yarn add go-captcha-solid
# or
npm install go-captcha-solid
# or
pnpm install go-captcha-solid
yarn add go-captcha-solid
# or
npm install go-captcha-solid
# or
pnpm install go-captcha-solid
点选式
jsx
import GoCaptcha from 'go-captcha-solid';
<GoCaptcha.Click
config={{}}
data={{}}
events={{}}
/>
import GoCaptcha from 'go-captcha-solid';
<GoCaptcha.Click
config={{}}
data={{}}
events={{}}
/>
参数
ts
// config = {}
interface Config {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
buttonText?: string;
}
// data = {}
interface Data {
image: string;
thumb: string;
}
// events = {}
interface Events {
click?: (x: number, y: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (dots: Array<CaptchaDot>) => boolean;
}
// config = {}
interface Config {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
buttonText?: string;
}
// data = {}
interface Data {
image: string;
thumb: string;
}
// events = {}
interface Events {
click?: (x: number, y: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (dots: Array<CaptchaDot>) => boolean;
}
滑动式
jsx
import GoCaptcha from 'go-captcha-solid';
<GoCaptcha.Slide
config={{}}
data={{}}
events={{}}
/>
<GoCaptcha.SlideRegion
config={{}}
data={{}}
events={{}}
/>
import GoCaptcha from 'go-captcha-solid';
<GoCaptcha.Slide
config={{}}
data={{}}
events={{}}
/>
<GoCaptcha.SlideRegion
config={{}}
data={{}}
events={{}}
/>
参数
ts
// config = {}
interface Config {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
}
// data = {}
interface Data {
thumbX: number;
thumbY: number;
thumbWidth: number;
thumbHeight: number;
image: string;
thumb: string;
}
// events = {}
interface Events {
move?: (x: number, y: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (point: CaptchaPoint) => boolean;
}
// config = {}
interface Config {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
}
// data = {}
interface Data {
thumbX: number;
thumbY: number;
thumbWidth: number;
thumbHeight: number;
image: string;
thumb: string;
}
// events = {}
interface Events {
move?: (x: number, y: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (point: CaptchaPoint) => boolean;
}
旋转式
jsx
import GoCaptcha from 'go-captcha-solid';
<GoCaptcha.Rotate
config={{}}
data={{}}
events={{}}
/>
import GoCaptcha from 'go-captcha-solid';
<GoCaptcha.Rotate
config={{}}
data={{}}
events={{}}
/>
参数
ts
// config = {}
interface Config {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
}
// data = {}
interface Data {
angle: number;
image: string;
thumb: string;
}
// events = {}
interface Events {
rotate?: (angle: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (angle: number) => boolean;
}
// config = {}
interface Config {
width?: number;
height?: number;
thumbWidth?: number;
thumbHeight?: number;
verticalPadding?: number;
horizontalPadding?: number;
showTheme?: boolean;
title?: string;
}
// data = {}
interface Data {
angle: number;
image: string;
thumb: string;
}
// events = {}
interface Events {
rotate?: (angle: number) => void;
refresh?: () => void;
close?: () => void;
confirm?: (angle: number) => boolean;
}
按钮
vue
<GoCaptcha.Button />
<GoCaptcha.Button />
参数
ts
interface _ {
config?: CaptchaConfig;
clickEvent?: () => void;
disabled?: boolean;
type?: "default" | "warn" | "error" | "success";
title?: string;
}
export interface CaptchaConfig {
width?: number;
height?: number;
verticalPadding?: number;
horizontalPadding?: number;
}
interface _ {
config?: CaptchaConfig;
clickEvent?: () => void;
disabled?: boolean;
type?: "default" | "warn" | "error" | "success";
title?: string;
}
export interface CaptchaConfig {
width?: number;
height?: number;
verticalPadding?: number;
horizontalPadding?: number;
}
主题颜色配置
主题颜色配置请参考 验证码主题配置。