mirror of https://github.com/sveltejs/svelte
parent
8098b6bc7e
commit
3972cecf5e
@ -0,0 +1,13 @@
|
|||||||
|
<script>
|
||||||
|
let slot = 'dynamic-slot';
|
||||||
|
|
||||||
|
const f = () => {
|
||||||
|
slot = 'thing';
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<slot name={slot} />
|
||||||
|
<slot />
|
||||||
|
<slot name='static' />
|
||||||
|
</div>
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
export default {
|
||||||
|
compileOptions: {
|
||||||
|
dev: true
|
||||||
|
},
|
||||||
|
|
||||||
|
html: '<div><p slot="dynamic-slot">Hello</p><p slot="default">Hello</p><p slot="static">Hello</p></div>',
|
||||||
|
|
||||||
|
warnings: ['<Nested> received an unexpected slot "dynamic-slot-again".']
|
||||||
|
};
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
import Nested from './Nested.svelte';
|
||||||
|
|
||||||
|
let slot = 'dynamic-slot';
|
||||||
|
|
||||||
|
function y() {
|
||||||
|
slot = 'another-slot';
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Nested>
|
||||||
|
<p slot={slot}>Hello</p>
|
||||||
|
<p slot='default'>Hello</p>
|
||||||
|
<p slot='static'>Hello</p>
|
||||||
|
<p slot={`${slot}-again`}>Hello</p>
|
||||||
|
</Nested>
|
||||||
Loading…
Reference in new issue