The input input box restricts the input of numbers only, and then the two-way binding fails after inputting Chinese characters.

question:

In vue+element UI projects, it is often necessary to limit the input box to integers or decimals. Generally, it is similar to the following: ninput="value=value.replace(/^(\d*\.?\d{0,2} " Sometimes you find that your v-model is invalid. Such misoperation will cause various problems in your program, such as field validation, saving data that is not the last data you filled in, etc.

solve:

Reassign after input blur

If your input defines a blur event, you need to write the reassignment into the method.

Guess you like

Origin blog.csdn.net/qq_30893717/article/details/133351044