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 value out of sync with data #11621

Closed
mvgn opened this issue Aug 27, 2020 · 1 comment
Closed

Input value out of sync with data #11621

mvgn opened this issue Aug 27, 2020 · 1 comment

Comments

@mvgn
Copy link

mvgn commented Aug 27, 2020

Version

2.6.12

Reproduction link

https://jsfiddle.net/arzmp4cv/

Steps to reproduce

Enter a price with more than 2 decimal places.

What is expected?

Input value should show no more than 2 decimal places.

What is actually happening?

Price data attribute is correctly limited to 2 decimal places but input value shows extra digits entered.


Is this a bug or a feature? If it's a feature, what is the recommended workaround? I see I can $forceUpdate() when updating the price or I can manually sync the input value with event.target.value = this.price (but I don't know if that might have adverse consequences, though).

@posva
Copy link
Member

posva commented Aug 27, 2020

This is expected in Vue. You can both use forceUpdate or manually setting the input's value through a ref (better)

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

No branches or pull requests

2 participants