Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input [v-model & type=number] is truncated when (unrelated) DOM update happens. #4392

Closed
patrickb1991 opened this issue Dec 5, 2016 · 4 comments
Labels

Comments

@patrickb1991
Copy link

Vue.js version

v2.1.3

Reproduction Link

http://jsfiddle.net/1y2nk1L9/5/

Steps to reproduce

Enter a number with some zeros after the comma into a type="number" input field, while Vue performs some page rendering in the background with (unrelated) variables of the same component.

What is Expected?

Entering a number like 1.00001 works without issues.

What is actually happening?

Every time Vue triggers a DOM change all v-model input fields are "re-rendered" ("0.000" -> "0") which makes it impossible to enter decimal numbers that contain zeros in busy components. While this sounds like a minor issue it is a huge problem, since the entered number could be completely wrong. Imagine entering 1.00345, but the input is silently changed to 1345. This has already led to some serious trouble in our (financial) Vue application.

@defcc
Copy link
Member

defcc commented Dec 6, 2016

When input gets focused and the user is inputing something, the input value property should not be updated. I'll make a patch.

@defcc
Copy link
Member

defcc commented Dec 6, 2016

The same problem with trim modifier, I'll try to fix it together.

@yyx990803
Copy link
Member

Hey @patrickb1991 , sorry for the potential problems this have caused in your app. Before a new release is out, you can build Vue from the dev branch locally to see if it fixes your issue.

@patrickb1991
Copy link
Author

No problem @yyx990803! Thanks for your great work and the fast fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants