Skip to content

关于Vue 3的v-model的bug报告 #10503

New issue

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

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

Already on GitHub? # to your account

Closed
mygitlab-debug opened this issue Mar 12, 2024 · 1 comment · Fixed by #10506
Closed

关于Vue 3的v-model的bug报告 #10503

mygitlab-debug opened this issue Mar 12, 2024 · 1 comment · Fixed by #10506
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: v-model

Comments

@mygitlab-debug
Copy link

Vue version

3.2.47

Link to minimal reproduction

https://play.vuejs.org/#eNp9UslOwzAQ/RXLQiKVSgKCU0krFvVQDgUBR19COkldHNvyEoqi/Dtjhy6Hqje/xeP3bHf0Ueu09UAnNLel4doRC87rGZO80co40hEDFelJZVRDLtF6ySSTpZLWkcbWZBr05Hp0YJVcSO0dKkkCIzKdkY5JQoKoBKRcViqB1BWmBpe2hfAwug8GnDZA3Ln0zReYE7YeD8qzISqGROCg0aJwgIiQfH0z67oYrO/zDFFkeQzkfjVMGZVxNqOkvWrUCgRS6Ef8EG0I/xskF9CCdCNGMxyTZ0cn0TF1FhtVvE43Vkm8v1iS0VI1mgswr9pxbMzoZKgftEII9fMSOWc8jHd8uYby+wS/sdvAMfpmwIJpgdG9NlzMIM8/lrDF9V7EXl6g+4z4DvgaPmQcbE9erjD2kS+mXcRfwGX9aedbB9LuSoWgwdlHP6P4M57PVD/EvU3v4j58S9r/ARxj1a8=

Steps to reproduce

1.写一个input标签,type为number,用v-model绑定值
2.通过输入框输入01,触发oninput事件
3.直接吧v-model的绑定值替换为数字1

What is expected?

页面input输入框应显示1

What is actually happening?

实际上页面input输入框还是显示01

System Info

No response

Any additional comments?

No response

@edison1105 edison1105 added 🐞 bug Something isn't working scope: v-model labels Mar 13, 2024
@edison1105
Copy link
Member

edison1105 commented Mar 13, 2024

The early return here causes el.value not to be updated

const elValue =
number || el.type === 'number' ? looseToNumber(el.value) : el.value
const newValue = value == null ? '' : value
if (elValue === newValue) {
return
}

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: v-model
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants