mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
try to fix reactivity
This commit is contained in:
parent
4d82e78f2c
commit
1c0f7e7856
1 changed files with 5 additions and 1 deletions
|
@ -29,7 +29,7 @@
|
||||||
/** Obtain a reference to the input HTML element */
|
/** Obtain a reference to the input HTML element */
|
||||||
export let ref = null;
|
export let ref = null;
|
||||||
|
|
||||||
import { getContext } from "svelte";
|
import { getContext, onDestroy } from "svelte";
|
||||||
import CheckmarkFilled16 from "carbon-icons-svelte/lib/CheckmarkFilled16";
|
import CheckmarkFilled16 from "carbon-icons-svelte/lib/CheckmarkFilled16";
|
||||||
|
|
||||||
const { update, selectedValues, _light } = getContext("SelectableTileGroup");
|
const { update, selectedValues, _light } = getContext("SelectableTileGroup");
|
||||||
|
@ -41,6 +41,10 @@
|
||||||
light = light || _light;
|
light = light || _light;
|
||||||
|
|
||||||
$: selected = $selectedValues.indexOf(value) > -1;
|
$: selected = $selectedValues.indexOf(value) > -1;
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
update({ value, selected: false });
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue