Element: [Bug Report] el-input-number initial value

Created on 13 Jul 2018  ·  6Comments  ·  Source: ElemeFE/element

Element UI version

2.4.3

OS/Browsers version

Win10/Chrome 66

Vue version

2.5.16

Reproduction Link

https://codepen.io/guohao/project/editor/AQyJkr

Steps to reproduce

when a property is null, the value of el-input-number become zero automatically.

What is Expected?

Initializes the el-input-numbe,The initial value is empty

What is actually happening?

el-input-number value become to zero

input-number next major candidate stale

All 6 comments

@wisdomsuper you can set the initial value to undefined.
https://github.com/ElemeFE/element/blob/b18642f716aedae9e8de409b64c078bf510ba264/packages/input-number/src/input-number.vue#L107-L110
The initial value doesn't support null and null can be converted to 0.

It's not convenient,the data usually generated by JSON, I must change the json generation.

I am facing this issue as well, this is really frustrating as the only solution - workaround provided here is to add a watcher on the actual input value, which decreases dramatically the performances when typing in it.
It is also not convenient as my data comes from the server, and the server doesn't handle undefined values...
@Leopoldthecoder What do you think? Is there anything else we can do to bypass this?

I have the same issue. When empty, the number value is undefined and firestore throws an error as undefined is not a number.

The number input should always be a number, 0 should be it's default empty value.

Or you should at least have the option to make 0 the default/empty value.

There is plan to rewrite input-number to support null/undefined zero. Resetting invalid value is inappropriate, and will cause problem when there are not @input event handler.

Reopen this issue.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings