mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 02:41:05 +00:00
fix(RadioButtonGroup): make selected prop reactive
This commit is contained in:
parent
cfe05bb2b2
commit
109f71b5cf
1 changed files with 12 additions and 2 deletions
|
@ -26,7 +26,7 @@
|
||||||
*/
|
*/
|
||||||
export let id = undefined;
|
export let id = undefined;
|
||||||
|
|
||||||
import { createEventDispatcher, setContext } from "svelte";
|
import { beforeUpdate, createEventDispatcher, onMount, setContext } from "svelte";
|
||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
@ -44,7 +44,17 @@
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$: selected = $selectedValue;
|
onMount(() => {
|
||||||
|
$selectedValue = selected
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeUpdate(() => {
|
||||||
|
$selectedValue = selected
|
||||||
|
})
|
||||||
|
|
||||||
|
$: $selectedValue, (() => {
|
||||||
|
selected = $selectedValue
|
||||||
|
})
|
||||||
$: dispatch("change", $selectedValue);
|
$: dispatch("change", $selectedValue);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue