Skip to content

Commit

Permalink
Support submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
Oceania2018 committed Jan 15, 2024
1 parent 9118f7f commit b403716
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 9 additions & 3 deletions src/routes/VerticalLayout/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import { browser } from '$app/environment';
import Footer from './Footer.svelte';
import { onMount } from 'svelte';
import { getPluginMenu } from '$lib/services/plugin-service';
/** @type {import('$types').PluginMenuDefModel[]} */
let menu;
const toggleRightBar = () => {
if (browser) {
Expand All @@ -20,7 +24,8 @@
toggleRightBar();
};
onMount(() => {
onMount(async () => {
menu = await getPluginMenu();
if (browser) {
document.body.setAttribute('data-layout', 'vertical');
}
Expand All @@ -29,8 +34,9 @@

<div id="layout-wrapper">
<Header {toggleRightBar} />
<Sidebar />

{#if menu}
<Sidebar menu={menu}/>
{/if}
<div class="main-content">
<div class="page-content">
<div class="container-fluid">
Expand Down
8 changes: 2 additions & 6 deletions src/routes/VerticalLayout/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
import { page } from '$app/stores';
import { browser } from '$app/environment';
import { _ } from 'svelte-i18n'
import { getPluginMenu } from '$lib/services/plugin-service';
/** @type {import('$types').PluginMenuDefModel[]} */
let menu = [];
onMount(async () => {
menu = await getPluginMenu();
});
export let menu
// after routing complete call afterUpdate function
afterUpdate(() => {
Expand Down Expand Up @@ -57,7 +53,7 @@
}
};
onMount(() => {
onMount(async () => {
const menuElement = document.querySelector('#vertical-menu');
OverlayScrollbars(menuElement, options);
activeMenu();
Expand Down

0 comments on commit b403716

Please sign in to comment.