一个基于原生JavaScript开发的、轻量的验证码生成插件html
V: 1.0.0git
DEMO:https://jofunliang.github.io/Vcode.js/example.htmlgithub
<script src="Vcode.min.js"></script>
OR浏览器
// ES6 Modules or TypeScript import vcode from 'Vcode' // CommonJS const vcode = require('Vcode')
Support AMD/CMD/ES6 module standard.字体
var vcode1 = new Vcode({ el:"#demo1 .code", count:4, fontSize:"60px", type:"number", spacing:0 });
attribute | typeof | description |
---|---|---|
el | string | 必需,接受一个包含CSS选择符的字符串,而后用它来匹配一个元素。 |
data | string | 可选,您能够自定义验证码的数据源。 |
count | number | 可选,验证码的长度,默认为4 |
type | string | 可选,验证码的类型,有三种模式,分别是数字模式、字母模式、数字字母随机混合模式。默认是数字字母随机混合模式 |
fontSize | string | 可选,验证码的字体大小。 |
spacing | string | 可选,验证码的字母间距。默认值为0 |
property | typeof | description |
---|---|---|
el | object | 挂载元素。 |
code | string | 验证码。 |
data | string | 验证码的数据源。 |
count | number | 验证码的长度。 |
onReset | function | 从新生成新的验证码。 |
注:此插件在ie8和ie9浏览器上会降级显示。ui