fix(Stepper): should format model-value

This commit is contained in:
chenjiahan 2020-12-28 20:57:44 +08:00
parent c4214b96a2
commit 81494dfa13

View File

@ -201,7 +201,9 @@ export default createComponent({
input.value = formatted; input.value = formatted;
} }
setValue(formatted); // perfer number type
const isNumeric = formatted === String(+formatted);
setValue(isNumeric ? +formatted : formatted);
}; };
const onFocus = (event: Event) => { const onFocus = (event: Event) => {
@ -290,7 +292,7 @@ export default createComponent({
() => props.modelValue, () => props.modelValue,
(value) => { (value) => {
if (!equal(value, current.value)) { if (!equal(value, current.value)) {
current.value = value!; current.value = format(value!);
} }
} }
); );