Update to svelte 5
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<script lang="ts" context="module">
|
||||
<script lang="ts" module>
|
||||
export type Tab = {
|
||||
path: string,
|
||||
title: string,
|
||||
icon: string,
|
||||
component?: ComponentType,
|
||||
component?: Component,
|
||||
hidden?: boolean,
|
||||
hide_background?: boolean,
|
||||
hide_frame?: boolean,
|
||||
@@ -11,11 +11,13 @@ export type Tab = {
|
||||
};
|
||||
</script>
|
||||
<script lang="ts">
|
||||
import { onMount, type ComponentType } from "svelte";
|
||||
import { onMount, type Component } from "svelte";
|
||||
import { current_page_store } from "wrap/RouterStore";
|
||||
|
||||
export let title = ""
|
||||
export let pages: Tab[] = []
|
||||
let { title = $bindable(""), pages = $bindable([]) }: {
|
||||
title?: string;
|
||||
pages?: Tab[];
|
||||
} = $props();
|
||||
|
||||
const get_page = () => {
|
||||
current_page = null
|
||||
@@ -55,8 +57,8 @@ const get_page = () => {
|
||||
pages = pages
|
||||
}
|
||||
|
||||
let current_page: Tab = null
|
||||
let current_subpage: Tab = null
|
||||
let current_page: Tab = $state(null)
|
||||
let current_subpage: Tab = $state(null)
|
||||
|
||||
onMount(() => {
|
||||
get_page()
|
||||
@@ -100,10 +102,10 @@ onMount(() => {
|
||||
</div>
|
||||
|
||||
{#if current_subpage}
|
||||
<svelte:component this={current_subpage.component} />
|
||||
<current_subpage.component />
|
||||
{/if}
|
||||
{:else}
|
||||
<svelte:component this={current_page.component} />
|
||||
<current_page.component />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user