|
|
|
@ -1,5 +1,5 @@ |
|
|
|
<script> |
|
|
|
import { getContext, setContext } from "svelte" |
|
|
|
import { getContext } from "svelte" |
|
|
|
import Router from "svelte-spa-router" |
|
|
|
import { routeStore } from "../store" |
|
|
|
import Screen from "./Screen.svelte" |
|
|
|
@ -10,12 +10,10 @@ |
|
|
|
// Only wrap this as an array to take advantage of svelte keying, |
|
|
|
// to ensure the svelte-spa-router is fully remounted when route config |
|
|
|
// changes |
|
|
|
$: configs = [ |
|
|
|
{ |
|
|
|
routes: getRouterConfig($routeStore.routes), |
|
|
|
id: $routeStore.routeSessionId, |
|
|
|
}, |
|
|
|
] |
|
|
|
$: config = { |
|
|
|
routes: getRouterConfig($routeStore.routes), |
|
|
|
id: $routeStore.routeSessionId, |
|
|
|
} |
|
|
|
|
|
|
|
const getRouterConfig = routes => { |
|
|
|
let config = {} |
|
|
|
@ -33,11 +31,11 @@ |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
{#each configs as config (config.id)} |
|
|
|
{#key config.id} |
|
|
|
<div use:styleable={$component.styles}> |
|
|
|
<Router on:routeLoading={onRouteLoading} routes={config.routes} /> |
|
|
|
</div> |
|
|
|
{/each} |
|
|
|
{/key} |
|
|
|
|
|
|
|
<style> |
|
|
|
div { |
|
|
|
|