1.0.1 • Published 6 years ago

verify-input-code v1.0.1

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

verify-input-code

基于Vue2.0+的移动端验证码输入组件.

功能预览

  • 输入时回调
  • 结果回调
  • 自定义错误处理
  • 自定义验证码个数
  • 样式可控
  • 可以清空输入的验证码

基于

基于 Vue.js 2.0+.

安装和使用

npm i verify-input-code --save
  • 作为全局组件使用
//在项目入口文件
import Vue from 'vue';
import VerifyInputCode from 'verify-input-code';
Vue.component('verifyInputCode', verifyInputCode)
  • 作为局部组件
//在某个组件中
import VerifyinputCode from 'verify-input-code'
export default {
  components: {
    VerifyinputCode
  }
}

API

参数类型说明可选值默认值
code数组用户输入的验证码数组
initInput函数给父组件调用初始化输入框-
type字符串用户输入类型 当type为idcard时 number值为 18number,text,idcardnumber
upper-caseBoolean类型为text的时候可调整输入的字符串为大写true,falsefalse
get-input函数用户每次输入后的回调函数,接受一个验证码字符串
success函数用户输入完成后的回调函数,接受一个验证码字符串
error函数用户输入不是预期的值的回调函数,接收一个错误的值,若返回true则不清除错误值并继续下一个输入,默认返回false
span-size字符串输入后的字体显示大小20px
span-color字符串输入后的字体显示颜色#f35252
input-size字符串输入框的字体显示大小20px
input-color字符串输入框的字体显示颜色#000
number数字验证码个数6
height字符串整个框的显示高度60px