input特殊输入框

Posted lfxanla

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了input特殊输入框相关的知识,希望对你有一定的参考价值。

     <span class="demonstration">姓名</span>
     <el-input v-model="value3" placeholder="只能输入中文"  align="right"  style=‘width:100px‘  onInput="this.value=this.value.replace(/[^u4e00-u9fa5]/g,‘‘)"></el-input>

     <span class="demonstration">价格</span>
     <el-input v-model="value4" placeholder="只能输入数字带小数点的"  align="right"  style=‘width:100px‘  onInput="if(isNaN(value))execCommand(‘undo‘)"  onafterpaste="if(isNaN(value))execCommand(‘undo‘)"></el-input>

     <span class="demonstration">年龄</span>
     <el-input v-model="value5" placeholder="只能输入纯数字"  align="right"  style=‘width:100px‘ onInput="value = value.replace(/[^d]/g,‘‘)"></el-input>
     
     <span class="demonstration">密码</span>
     <el-input v-model="value6" placeholder="只输入数字和字母"  align="right"  style=‘width:150px‘   maxlength="12" onInput="value=value.replace(/[W]/g,‘‘)"></el-input>

  

以上是关于input特殊输入框的主要内容,如果未能解决你的问题,请参考以下文章