Skip to content

Commit

Permalink
fix(runtime-dom): equal value with a leading 0 do not trigger update
Browse files Browse the repository at this point in the history
fix #10503
  • Loading branch information
OnlyWick committed Mar 13, 2024
1 parent 9e8ac0c commit fa8f257
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/runtime-dom/src/directives/vModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ export const vModelText: ModelDirective<
el[assignKey] = getModelAssigner(vnode)
// avoid clearing unresolved text. #2302
if ((el as any).composing) return

const elValue =
number || el.type === 'number' ? looseToNumber(el.value) : el.value
number || (el.type === 'number' && el.value[0] !== '0')
? looseToNumber(el.value)
: el.value
const newValue = value == null ? '' : value

if (elValue === newValue) {
Expand Down

0 comments on commit fa8f257

Please sign in to comment.