In the vue project, el-input type="number" can input the letter e. - the problem is solved

<el-input v-model.number="val" type="tel" min="0" max="102400" @input="val = String(val).replace(/[^\d]/g,'')" 
/>

The v-model of the input is changed to v-model.number, the type is changed to tel, and the input event uses the replace() method of the string to replace the non-number content with nothing, and then the input can only input positive integers.

Guess you like

Origin blog.csdn.net/m0_67948827/article/details/128484985