mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
getting previous value before changes are made
This commit is contained in:
parent
6b0ed4cc05
commit
28baee93b1
1 changed files with 6 additions and 1 deletions
|
@ -117,13 +117,14 @@
|
|||
const dispatch = createEventDispatcher();
|
||||
|
||||
function updateValue(isIncrementing) {
|
||||
previousValue = ref.value;
|
||||
|
||||
if (isIncrementing) {
|
||||
ref.stepUp();
|
||||
} else {
|
||||
ref.stepDown();
|
||||
}
|
||||
|
||||
previousValue = ref.value;
|
||||
value = +ref.value;
|
||||
|
||||
dispatch("input", value);
|
||||
|
@ -141,6 +142,10 @@
|
|||
$: ariaLabel =
|
||||
$$props["aria-label"] ||
|
||||
"Numeric input field with increment and decrement buttons";
|
||||
$: {
|
||||
console.log("previousValue / value", previousValue, value);
|
||||
console.log();
|
||||
}
|
||||
|
||||
function parse(raw) {
|
||||
return raw != "" ? Number(raw) : null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue