Blogger Information
Blog 67
fans 0
comment 2
visits 71806
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
input输入限制
搁浅
Original
985 people have browsed it

只能输入数字

  1. <el-input
  2. v-model="parseObj"
  3. placeholder="请输入数字"
  4. @keyup.native="parseObj=parseObj.replace(/[^\d]/g,'')"
  5. maxlength="9"
  6. >
  7. </el-input>

输入框只能输入汉字

  1. <el-input
  2. v-model="parseObj"
  3. placeholder="请输入汉字"
  4. @keyup.native="parseObj=parseObj.replace(/[\u4E00-\u9FA5]/g,'')"
  5. maxlength="9"
  6. >
  7. </el-input>

输入框输入除汉字以外的文字

  1. <el-input
  2. v-model="parseObj"
  3. placeholder="请输入汉字"
  4. @keyup.native="parseObj=parseObj.replace(/[\u4E00-\u9FA5]/g,'')"
  5. maxlength="9"
  6. >
  7. </el-input>

输入框只能输入字母

  1. <el-input
  2. v-model="parseObj"
  3. placeholder="请输入字母"
  4. @keyup.native="parseObj=parseObj.replace(/[^A-Za-z0-9]/g,'')"
  5. maxlength="9"
  6. >
  7. </el-input>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post