0.3.9 • Published 3 years ago

@itriton/captcha v0.3.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

itriton-captcha

star fork

itriton-captcha itriton-captcha

介绍

生成滑动验证码拼图图片和背景图片

安装

npm i @itriton/captcha

使用方法

const captcha = require('@itriton/captcha')

// 默认(promise)
captcha.create().then(res=>{
    console.log(res)
})

// 自定义参数(promise)
captcha.create(options).then(res=>{
    console.log(res)
})

// 默认(async/await)
async function captcha(){
   const result = await captcha.create()
}

// 自定义参数(async/await)
async function captcha(){
   const result = await captcha.create(options)
}

参数

属性名类型默认值说明
sizeNumber30默认拼图大小
widthNumber270图片宽度(px)
heightNumber144图片高度(px)
urlString-图片路径(支持在线地址)

返回值

属性名类型说明
backgroundImageBase64背景图片
jigsawImageBase64拼图图片
xNumberx轴距离

安装sharp失败的解决方案

切换成淘宝镜像再执行npm install sharp命令

npm config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"

npm config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"

npm install sharp

效果图

结合 @itriton/uniapp 组件库的 行为验证(captcha)组件的实际效果

npm.io

其他开源项目

ibaleine-weapp

基于原生小程序框架的小程序商城

star fork

GitHub stars GitHub forks

@itriton/uniapp

@itriton/uniapp,是基于uni-app生态开发的组件库

star fork

GitHub stars GitHub forks

0.3.9

3 years ago

0.3.8

3 years ago

0.3.6

4 years ago

0.3.7

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago