From 81494dfa13e6ab9a3f12995f481290d27d14ab7a Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Mon, 28 Dec 2020 20:57:44 +0800 Subject: [PATCH] fix(Stepper): should format model-value --- src/stepper/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/stepper/index.tsx b/src/stepper/index.tsx index 9f1148138..efa1d7a01 100644 --- a/src/stepper/index.tsx +++ b/src/stepper/index.tsx @@ -201,7 +201,9 @@ export default createComponent({ input.value = formatted; } - setValue(formatted); + // perfer number type + const isNumeric = formatted === String(+formatted); + setValue(isNumeric ? +formatted : formatted); }; const onFocus = (event: Event) => { @@ -290,7 +292,7 @@ export default createComponent({ () => props.modelValue, (value) => { if (!equal(value, current.value)) { - current.value = value!; + current.value = format(value!); } } );