-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
v-model
overrides the value of a number with trailing zeros
#7003
Comments
… input of type number (vuejs#7003)
…input of type number (vuejs#7003)
@sxzz hey bro, help me to determine if it is a bug, thank you 🙏 |
v-model
does not update correctly when the element is an input of type numberv-model
overrides the value of a number with trailing zeros
This is a side effect of vue rendering again and setting the input value to the new value which have the trailing zeros stripped as it's a number. I remember we discussed this kind of formatting requires handling with a string (so any trailing zero is kept) in userland but I think this could be improved too. At the time I think we didn't cast the v-model variable to a number unless the |
Then can we add some judgment conditions to solve this problem, like the pr I put forward |
Vue version
3.2.41
Link to minimal reproduction
https://sfc.vuejs.org/#eNp9kd1ugzAMhV/Fyg2bVEjJJYJKe4/ctNRsVM2PnMA0Id59DrQT66ZeOcc++Rw7k3jzvhgHFJWoQ0u9jxAwDv6gbW+8owgTEHYwQ0fOQMbWTFttW2dDBDuYEppkeCmL/V69bgrqoVDLlc9kFhGNvx4jsgKo/aG3fohlLVNjTiwSxty4M14bLVIjLSB+eWwyFiekDO53U4DlLdU0pTDPS+UOu9HVM7r6n/4Lr1a82uJr+TOJ2Il1Zbk5+uISnOWlTsmqb4WgRQVLJuV4lUlr8RGjD5WUoWvTV1xC4ehd8qmgwcbeYIHB5CdynwGJwVrsNgzJyREpJ7RnJKRnzAfrH27C8nCzmL8Bq8W0nQ==
Steps to reproduce
1.Delete the data of
input1
, from1.002
to1.00
2.Delete the data of
input2
, from1.002
to1.00
2022-11-01.20.52.52.mov
What is expected?
After step 1 is executed. The display value of input1 is
1.00
.After step 2 is executed, the display value of input1 and input2 are both
1.00
What is actually happening?
After step 1 is executed. input1 shows a value of
1.00
, but when step 2 is executed, input1 shows a value of1
System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: