props-bindable
Simon Holthausen 1 year ago
parent 376898f62d
commit 0bcc55d52f

@ -1,6 +1,5 @@
<script> <script>
let { value, ...props } = $props(); let { value, ...props } = $props.bindable();
</script> </script>
<button {...props} onclick={() => value++}>{value}</button> <button {...props} onclick={() => value++}>{value}</button>

@ -1,5 +1,5 @@
<script> <script>
let { checked, ...rest } = $props(); let { checked, ...rest } = $props.bindable();
</script> </script>
<input type="checkbox" bind:checked {...rest} /> <input type="checkbox" bind:checked {...rest} />

@ -1,5 +1,5 @@
<script> <script>
let { count: definedCount } = $props(); let { count: definedCount } = $props.bindable();
</script> </script>
<button on:click={() => definedCount++}>{definedCount}</button> <button on:click={() => definedCount++}>{definedCount}</button>

@ -1,5 +1,5 @@
<script> <script>
let { bar } = $props(); let { bar } = $props.bindable();
</script> </script>
<button on:click={() => bar--}>{bar}</button> <button on:click={() => bar--}>{bar}</button>

@ -1,5 +1,5 @@
<script> <script>
let { count } = $props(); let { count } = $props.bindable();
</script> </script>
<button on:click={() => count++}>{count}</button> <button on:click={() => count++}>{count}</button>

@ -1,5 +1,5 @@
<script> <script>
let { readonly, readonlyWithDefault = 1, binding } = $props(); let { readonly, readonlyWithDefault = 1, binding } = $props.bindable();
</script> </script>
<p> <p>

Loading…
Cancel
Save