- V: 1.0.0
- DEMO: https://jofunliang.github.io/Vcode.js/example.html https://jofunliang.github.io/Vcode.js/example.html
安装
- <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 |
new Vcode 对象的属性和方法
property | typeof | description |
---|---|---|
el | object | 挂载元素。 |
code | string | 验证码。 |
data | string | 验证码的数据源。 |
count | number | 验证码的长度。 |
onReset | function | 重新生成新的验证码。 |
注: 此插件在 ie8 和 ie9 浏览器上会降级显示.
来源: http://www.qdfuns.com/article/47066/852607902d97f1fdb28cdf61699b38d1.html