You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/dynamic-component-slot/main.html

45 lines
589 B

<svelte:component this="{ x ? Foo : Bar }" x='{x}'>
<p>element</p>
{tag}
{#if foo}
<p>foo</p>
{:elseif bar}
<p>bar</p>
{:else}
<p>neither foo nor bar</p>
{/if}
text
{#each things as thing}
<span>{thing}</span>
{/each}
<Baz/>
<div slot='other'>what goes up must come down</div>
</svelte:component>
<script>
import Foo from './Foo.html';
import Bar from './Bar.html';
import Baz from './Baz.html';
export default {
data() {
return {
Foo,
Bar,
tag: 'you\'re it',
things: ['a', 'b', 'c']
};
},
components: {
Baz
}
};
</script>