AGENT SKILL
svelte5-runes
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-06-24
- Stars
- ★ 66
- Forks
- 24
03 SKILL.md 正文
Svelte 5 Runes
Reactivity
<script>
let count = $state(0);
let doubled = $derived(count * 2);
$effect(() => { console.log('Count:', count); });
</script>
<button onclick={() => count++}>{count} (doubled: {doubled})</button>
Props
<script>
let { name, age = 25 }: { name: string; age?: number } = $props();
</script>
Stores (shared state)
// stores.svelte.ts
class CounterStore {
count = $state(0);
increment() { this.count++; }
}
export const counter = new CounterStore();