From fa8f257a8a496bbd2b0174153203e6768202fa4e Mon Sep 17 00:00:00 2001 From: OnlyWick Date: Wed, 13 Mar 2024 15:26:05 +0800 Subject: [PATCH] fix(runtime-dom): equal value with a leading 0 do not trigger update fix #10503 --- packages/runtime-dom/src/directives/vModel.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/runtime-dom/src/directives/vModel.ts b/packages/runtime-dom/src/directives/vModel.ts index 9e94810d8cd..9f9744c1770 100644 --- a/packages/runtime-dom/src/directives/vModel.ts +++ b/packages/runtime-dom/src/directives/vModel.ts @@ -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) {