mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11: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;
|
||||
|
||||
import { createEventDispatcher, setContext } from "svelte";
|
||||
import { beforeUpdate, createEventDispatcher, onMount, setContext } from "svelte";
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
@ -44,7 +44,17 @@
|
|||
},
|
||||
});
|
||||
|
||||
$: selected = $selectedValue;
|
||||
onMount(() => {
|
||||
$selectedValue = selected
|
||||
})
|
||||
|
||||
beforeUpdate(() => {
|
||||
$selectedValue = selected
|
||||
})
|
||||
|
||||
$: $selectedValue, (() => {
|
||||
selected = $selectedValue
|
||||
})
|
||||
$: dispatch("change", $selectedValue);
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue