diff options
author | 2024-11-15 19:37:28 +0800 | |
---|---|---|
committer | 2024-11-15 19:37:28 +0800 | |
commit | 671f50c7d3c02ab9d23d8d38ecb8934d080b6a40 (patch) | |
tree | 45af7931d284ee47857c9bc5c172f12eff779b2f /examples/framework-svelte/src | |
parent | 4364bff27332e52f92da72392620a36110daee42 (diff) | |
parent | 55091174158a80f2e023571f6d10ffdbf17d274b (diff) | |
download | astro-671f50c7d3c02ab9d23d8d38ecb8934d080b6a40.tar.gz astro-671f50c7d3c02ab9d23d8d38ecb8934d080b6a40.tar.zst astro-671f50c7d3c02ab9d23d8d38ecb8934d080b6a40.zip |
Merge branch 'main' into next
Diffstat (limited to 'examples/framework-svelte/src')
-rw-r--r-- | examples/framework-svelte/src/components/Counter.svelte | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/examples/framework-svelte/src/components/Counter.svelte b/examples/framework-svelte/src/components/Counter.svelte index 1353736aa..a11538645 100644 --- a/examples/framework-svelte/src/components/Counter.svelte +++ b/examples/framework-svelte/src/components/Counter.svelte @@ -1,5 +1,12 @@ <script lang="ts"> - let count = 0; + import type { Snippet } from 'svelte'; + + interface Props { + children?: Snippet + } + + let { children }: Props = $props(); + let count = $state(0); function add() { count += 1; @@ -11,12 +18,12 @@ </script> <div class="counter"> - <button on:click={subtract}>-</button> + <button onclick={subtract}>-</button> <pre>{count}</pre> - <button on:click={add}>+</button> + <button onclick={add}>+</button> </div> <div class="message"> - <slot /> + {@render children?.()} </div> <style> |