After property input type = "number", can still enter e, E, -, + solution

<el-input v-model="scope.row.variables.leaderbuweiscores.score" @keyup.native="changeInput(scope.row)" onmousewheel="return false;" οninput="value=value.replace(/[^\d.]/g,'')" type="number" :disabled="scope.row.leaderBumenRoleId != user.roleId || notEnd">

  

the reason:

    e represents mathematically 2.71828, so it is still a digital

    The Internet to find a lot of solutions found are not very convenient to use them, and finally regular do is relatively simple

solution:

    Directly add an attribute in the input tag  οninput = "value = value.replace (/ [^ \ d] / g, '')"   to perfect solution

    If there are other input requirements, you can directly modify the regular expression, for example:

        Allowing a decimal:  οninput = "value = value.replace (/ [. ^ \ D] / G, '')"

 

Guess you like

Origin www.cnblogs.com/rieko/p/11288215.html