Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue Element UI - Default el-input-number to empty field instead of a number

Creating a form with no values and would like the input field to default to empty for two reasons:

  1. Want users to be able to see the placeholder text.
  2. Having a default number means the users can ignore the field by default. (I know I can validate the field, but that is just a bad user experience.)

The problem:

el-input-number fields default to a number (0 or whatever the :min value is set to).

  1. This covers up the placeholder text.
  2. The users can click save with the default number still in place. (I will validate, but don't want users to have to submit a bad value to know what to do.)

Does anyone know how to make the input field have the default value be just empty?

like image 636
zeusstl Avatar asked Oct 20 '25 16:10

zeusstl


1 Answers

just give it a default value of undefined

https://codepen.io/rugia/pen/bGEoWaB?editors=1010

like image 148
Jay Li Avatar answered Oct 23 '25 07:10

Jay Li



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!