mirror of https://github.com/sveltejs/svelte
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.
45 lines
580 B
45 lines
580 B
7 years ago
|
<:Switch { 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>
|
||
|
</:Switch>
|
||
|
|
||
|
<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>
|