Skip to content

Commit 796e6a4

Browse files
author
Pavlo Kulyk
committed
fix: streamline number input handling by removing NaN check and simplifying value assignment
1 parent 5456777 commit 796e6a4

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

adminforth/spa/src/afcl/Input.vue

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,17 @@ const emit = defineEmits<{
6060
6161
const onInput = (e: Event) => {
6262
const el = e.target as HTMLInputElement;
63-
const raw = el.value;
6463
6564
if (props.type === 'number') {
66-
const num = Number(raw);
67-
68-
if (isNaN(num)) {
69-
emit('update:modelValue', null);
70-
return;
71-
}
72-
73-
let val = num;
65+
let val = Number(el.value);
7466
7567
if (props.min != null && val < props.min) val = props.min;
7668
if (props.max != null && val > props.max) val = props.max;
7769
7870
el.value = String(val);
7971
emit('update:modelValue', val);
8072
} else {
81-
emit('update:modelValue', raw);
73+
emit('update:modelValue', el.value);
8274
}
8375
};
8476

0 commit comments

Comments
 (0)