mirror of https://github.com/sveltejs/svelte
parent
8270a2fd55
commit
a0b60cb137
@ -0,0 +1,6 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: '<span>hello from render</span>',
|
||||
context: new Map([['message', 'hello from render']])
|
||||
});
|
||||
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
import { getContext } from 'svelte';
|
||||
|
||||
const message = getContext('message');
|
||||
</script>
|
||||
|
||||
<span>{message}</span>
|
||||
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
import { getContext } from 'svelte';
|
||||
|
||||
const message = getContext('message');
|
||||
</script>
|
||||
|
||||
<span>{message}</span>
|
||||
@ -0,0 +1,5 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: '<div><span>hello from context</span></div>'
|
||||
});
|
||||
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import { setContext } from 'svelte';
|
||||
import Child from './Child.svelte';
|
||||
|
||||
setContext('message', 'hello from context');
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<Child />
|
||||
</div>
|
||||
Loading…
Reference in new issue