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/site/content/OLD.examples/self-references/App.svelte

42 lines
494 B

<script>
const node = {
name: 'Fruit',
children: [
{
name: 'Red',
children: [
{
name: 'Cherry'
},
{
name: 'Strawberry'
}
]
},
{
name: 'Green',
children: [
{
name: 'Apple'
},
{
name: 'Pear'
},
{
name: 'Lime'
}
]
}
]
};
</script>
<ul>
<li>{node.name}
{#if node.children}
{#each node.children as child}
<svelte:self node={child}/>
{/each}
{/if}
</li>
</ul>