1.0.2 • Published 4 years ago
captcha-login v1.0.2
import CaptchaLogin from "captcha-login"
let captcha = new CaptchaLogin({
lineWidth: 1, //线条宽度
lineNum: 6, //线条数量
dotR: 2, //点的半径
dotNum: 25, //点的数量
preGroundColor: [10, 80], //前景色区间
backGroundColor: [150, 250], //背景色区间
fontSize: 30, //字体大小
fontFamily: ['Georgia', '微软雅黑', 'Helvetica', 'Arial'], //字体类型
fontStyle: 'stroke', //字体绘制方法,有fill和stroke
content: 'acdefhijkmnpwxyABCDEFGHJKMNPQWXY12345789', //验证码内容
length: 6 //验证码长度
}); // 传值
captcha.draw(document.querySelector('#captcha'), r => {
console.log(r, '验证码2');
});
<canvas width="240" height="90" id="captcha"></canvas>