输入框只能输入数字
<el-input
v-model.number="parseObj"
placeholder="请输入数字"
@keyup.native="parseObj=parseObj.replace(/[^\d]/g,'')"
maxlength="9"
>
</el-input>
输入框只能输入汉字
<el-input
v-model.number="parseObj"
placeholder="请输入汉字"
@keyup.native="parseObj=parseObj.replace(/[\u4E00-\u9FA5]/g,'')"
maxlength="9"
>
</el-input>
输入框输入除汉字以为的文字
<el-input
v-model.number="parseObj"
placeholder="请输入汉字"
@keyup.native="parseObj=parseObj.replace(/[^\u4E00-\u9FA5]/g,'')"
maxlength="9"
>
</el-input>
输入框只能输入字母
<el-input
v-model.number="parseObj"
placeholder="请输入汉字"
@keyup.native="parseObj=parseObj.replace(/[^A-Za-z0-9]/g,'')"
maxlength="9"
>
</el-input>
|