[Commonly used code 14] The el-input input box determines the regularity. Only numbers can be entered, and Chinese characters + letters are filtered.

Problem Description:

The el-input input box can only enter numbers, but 不能显示输入框最右边的上下箭头,Insert image description here

<el-input v-model="input" type="number" placeholder="请输入内容" 
style="width: 200px;margin: 50px 0;"></el-input>

Solution

提示:这里描述
Use regular validation in the input box

Regular expression: /^\d*$/

Write directly in the el-input tag

oninput="value=value.replace(/[^\d]/g,'')"

Full code

<el-input v-model="input" placeholder="请输入名称" clearable size="small" oninput="value=value.replace(/[^\d]/g,'')" />

Guess you like

Origin blog.csdn.net/qq_51055690/article/details/132759016