mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 03:05:12 +00:00
Slot-based routing (#573)
This commit is contained in:
@@ -8,13 +8,16 @@
|
||||
|
||||
<script>
|
||||
import { preloading } from '@sapper/app';
|
||||
import { setContext } from 'svelte';
|
||||
|
||||
export let child;
|
||||
export let rootPreloadFunctionRan;
|
||||
|
||||
setContext('x', { rootPreloadFunctionRan });
|
||||
</script>
|
||||
|
||||
{#if $preloading}
|
||||
<progress class='preloading-progress' value=0.5/>
|
||||
{/if}
|
||||
|
||||
<svelte:component this={child.component} {rootPreloadFunctionRan} {...child.props}/>
|
||||
<slot></slot>
|
||||
@@ -1 +0,0 @@
|
||||
<svelte:component this={child.component} {...child.props}/>
|
||||
@@ -1 +0,0 @@
|
||||
<h1>root preload function ran: {rootPreloadFunctionRan}</h1>
|
||||
@@ -0,0 +1,6 @@
|
||||
<script>
|
||||
import { getContext } from 'svelte';
|
||||
const { rootPreloadFunctionRan } = getContext('x');
|
||||
</script>
|
||||
|
||||
<h1>root preload function ran: {rootPreloadFunctionRan}</h1>
|
||||
@@ -1 +0,0 @@
|
||||
<svelte:component this={child.component} {...child.props}/>
|
||||
Reference in New Issue
Block a user