mirror of https://github.com/sveltejs/svelte
Merge pull request #2249 from sveltejs/gh-2182
set/unset parent component correctly in SSRpull/2250/head
commit
e87976dc21
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
import { getContext } from 'svelte';
|
||||
import { ID } from './Nested.svelte';
|
||||
|
||||
const name = getContext('test');
|
||||
</script>
|
||||
|
||||
<div>{name}</div>
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import { getContext, setContext } from 'svelte';
|
||||
|
||||
export let name = '';
|
||||
|
||||
const parentName = getContext('test');
|
||||
setContext('test', parentName ? parentName + '/' + name : name);
|
||||
</script>
|
||||
|
||||
<slot></slot>
|
@ -0,0 +1,6 @@
|
||||
export default {
|
||||
html: `
|
||||
<div>foo/bar</div>
|
||||
<div>foo/baz</div>
|
||||
`
|
||||
};
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
import Nested from './Nested.svelte';
|
||||
import Leaf from './Leaf.svelte';
|
||||
</script>
|
||||
|
||||
<Nested name='foo'>
|
||||
<Nested name='bar'>
|
||||
<Leaf/>
|
||||
</Nested>
|
||||
<Nested name='baz'>
|
||||
<Leaf/>
|
||||
</Nested>
|
||||
</Nested>
|
Loading…
Reference in new issue