fix(number-input): decimal input

This commit is contained in:
AsakuraMizu 2020-12-04 11:07:17 +08:00
commit 8b18d16a6d

View file

@ -118,9 +118,11 @@
dispatch("change", value);
});
let inputValue = value;
$: incrementLabel = translateWithId("increment");
$: decrementLabel = translateWithId("decrement");
$: value = Number(value);
$: value = Number(inputValue);
$: error =
invalid || (!allowEmpty && value === "") || value > max || value < min;
$: errorId = `error-${id}`;
@ -181,7 +183,7 @@
aria-label="{label ? undefined : ariaLabel}"
on:input
on:input="{({ target }) => {
value = target.value;
inputValue = target.value;
}}"
disabled="{disabled}"
id="{id}"
@ -189,7 +191,7 @@
max="{max}"
min="{min}"
step="{step}"
value="{value}"
value="{inputValue}"
readonly="{readonly}"
/>
<button