zeusstl
zeusstl

Reputation: 1865

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?

Upvotes: 4

Views: 9136

Answers (1)

Jay Li
Jay Li

Reputation: 747

just give it a default value of undefined

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

Upvotes: 6

Related Questions