mirror of https://github.com/sveltejs/svelte
parent
fab34ab529
commit
8e515b12c3
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
/** @type {{ object: { count: number }}} */
|
||||
let { object = $bindable() } = $props();
|
||||
</script>
|
||||
|
||||
<button onclick={() => object.count += 1}>
|
||||
clicks: {object.count}
|
||||
</button>
|
||||
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
import Counter from './Counter.svelte';
|
||||
|
||||
/** @type {{ object: { count: number }}} */
|
||||
let { object } = $props();
|
||||
</script>
|
||||
|
||||
<Counter bind:object={object} />
|
||||
@ -0,0 +1,13 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `<button>clicks: 0</button>`,
|
||||
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
|
||||
warnings: [
|
||||
'.../samples/non-local-mutation-with-binding-2/Intermediate.svelte passed a value to .../samples/non-local-mutation-with-binding-2/Counter.svelte with `bind:`, but the value is owned by .../samples/non-local-mutation-with-binding-2/main.svelte. Consider creating a binding between .../samples/non-local-mutation-with-binding-2/main.svelte and .../samples/non-local-mutation-with-binding-2/Intermediate.svelte'
|
||||
]
|
||||
});
|
||||
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
import Intermediate from './Intermediate.svelte';
|
||||
|
||||
let object = $state({ count: 0 });
|
||||
</script>
|
||||
|
||||
<Intermediate object={object} />
|
||||
Loading…
Reference in new issue