The input box of Vue el-input automatically converts numbers

elementel-inputdoes not support the v-model modifier, so the input content cannot be converted into a number through v-model.number. If you directly set the type of el-input to number, there will be a stepping arrow on the right side of the input box, which is very difficult. ugly.

In fact, you can add an blurevent to automatically convert the content to a number when the input box loses focus.

<el-input v-model="value" @blur="value=Number(value)"></el-input>    

Guess you like

Origin blog.csdn.net/Maxueyingying/article/details/131005408
Recommended