0.0.7 • Published 4 years ago

vue-special-input v0.0.7

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

vue-special-input

vue组件,移动端使用,数字输入,小数输入,身份证输入,仿照微信小程序输入键盘

DEMO

体验

二维码

安装

npm i vue-special-input 
//或者
yarn add vue-special-input

使用

<script>
import VueSpecialInput,{isIdCard} from 'vue-special-input';

export default {
  data () {
    return {
      val:'',
    }
  },
  methods:{
    update(value,token){
	     if(token) this[token] = value;
	  }
  },
  components:{
    VueSpecialInput
  }
}
</script>

<template>
<VueSpecialInput :config="{type:'digit',value:val}" @update="update"></VueSpecialInput>
</template>

参数

config可选

  config = {
    type:'number',  // 'number','digit','idcard'  默认'number'
    maxlength:10,   //最大长度,默认10,type为身份证时,自动设置为18
    value:'',      //默认值
    token:'',      //原样返回
    classname:'',   //覆盖输入框样式 ,强制覆盖 样式里面使用 !important
    placeholder:'请输入数字'  //自定义placeholder
  }

事件

update(value,token)

value //返回输入结果
token //如果config对象配置了token,将返回config.token,或者返回''

函数

isIdCard(str)

return false // 无效的身份证号码
return Object //有效身份证 object={birthday:'xxx',gender:0|1}  0女性,1男性

开发

npm install

npm run dev

npm run build
0.0.7

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

1.0.0

4 years ago