23 lines
311 B
Svelte
23 lines
311 B
Svelte
|
|
||
|
<script>
|
||
|
let children;
|
||
|
let count = 0;
|
||
|
|
||
|
function add() {
|
||
|
count += 1;
|
||
|
}
|
||
|
|
||
|
function subtract() {
|
||
|
count -= 1;
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<div class="counter">
|
||
|
<button on:click={subtract}>-</button>
|
||
|
<pre>{ count }</pre>
|
||
|
<button on:click={add}>+</button>
|
||
|
</div>
|
||
|
<div class="children">
|
||
|
<slot />
|
||
|
</div>
|