mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
fix(slider): dispatch change event in reactive statement
Removes afterUpdate method
This commit is contained in:
parent
21c09ef3d8
commit
5e8915df7f
1 changed files with 5 additions and 7 deletions
|
@ -101,7 +101,7 @@
|
|||
*/
|
||||
export let ref = null;
|
||||
|
||||
import { createEventDispatcher, afterUpdate } from "svelte";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
|
@ -144,12 +144,6 @@
|
|||
value = nextValue;
|
||||
}
|
||||
|
||||
afterUpdate(() => {
|
||||
if (!holding) {
|
||||
dispatch("change", value);
|
||||
}
|
||||
});
|
||||
|
||||
$: range = max - min;
|
||||
$: left = ((value - min) / range) * 100;
|
||||
$: {
|
||||
|
@ -163,6 +157,10 @@
|
|||
calcValue(event);
|
||||
dragging = false;
|
||||
}
|
||||
|
||||
if (!holding) {
|
||||
dispatch("change", value);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue