mirror of https://github.com/sveltejs/svelte
45 lines
589 B
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> |