2024-08-23 12:42:32 +00:00
|
|
|
<template>
|
|
|
|
<SidebarLayout>
|
|
|
|
<template #sidebar>
|
|
|
|
<SidebarTemplate
|
|
|
|
:mainTitle="activeNavigationObject.mainTitle"
|
|
|
|
:topTitle="activeNavigationObject.topTitle"
|
|
|
|
:showTopList="activeNavigationObject.top != null"
|
|
|
|
>
|
|
|
|
<template #topList>
|
2024-11-16 11:19:13 +00:00
|
|
|
<RoutingLink
|
|
|
|
v-for="item in activeNavigationObject.top"
|
|
|
|
:key="item.key"
|
|
|
|
:title="item.title"
|
|
|
|
:link="{ name: `admin-${activeNavigation}-${item.key}` }"
|
|
|
|
:active="activeLink == item.key"
|
|
|
|
/>
|
2024-08-23 12:42:32 +00:00
|
|
|
</template>
|
|
|
|
<template #list>
|
2024-11-16 11:19:13 +00:00
|
|
|
<RoutingLink
|
|
|
|
v-for="item in activeNavigationObject.main"
|
|
|
|
:key="item.key"
|
|
|
|
:title="item.title"
|
|
|
|
:link="{ name: `admin-${activeNavigation}-${item.key}` }"
|
|
|
|
:active="activeLink == item.key"
|
|
|
|
/>
|
2024-08-23 12:42:32 +00:00
|
|
|
</template>
|
|
|
|
</SidebarTemplate>
|
|
|
|
</template>
|
|
|
|
<template #main>
|
2024-09-01 17:19:48 +00:00
|
|
|
<RouterView />
|
2024-08-23 12:42:32 +00:00
|
|
|
</template>
|
|
|
|
</SidebarLayout>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { defineComponent } from "vue";
|
|
|
|
import { mapState, mapActions } from "pinia";
|
|
|
|
import { useNavigationStore } from "@/stores/admin/navigation";
|
|
|
|
import SidebarLayout from "@/layouts/Sidebar.vue";
|
|
|
|
import SidebarTemplate from "@/templates/Sidebar.vue";
|
|
|
|
import RoutingLink from "@/components/admin/RoutingLink.vue";
|
2024-09-17 14:44:02 +00:00
|
|
|
import { useAbilityStore } from "@/stores/ability";
|
|
|
|
import { RouterView } from "vue-router";
|
2024-08-23 12:42:32 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
export default defineComponent({
|
|
|
|
computed: {
|
2024-11-16 11:19:13 +00:00
|
|
|
...mapState(useNavigationStore, [
|
|
|
|
"activeNavigationObject",
|
|
|
|
"activeTopLevelObject",
|
|
|
|
"activeLink",
|
|
|
|
"activeNavigation",
|
|
|
|
]),
|
2024-08-23 12:42:32 +00:00
|
|
|
},
|
|
|
|
created() {
|
2024-08-26 15:56:07 +00:00
|
|
|
useAbilityStore().$subscribe(() => {
|
|
|
|
this.updateTopLevel();
|
|
|
|
this.updateNavigation();
|
|
|
|
});
|
2024-12-23 13:06:15 +00:00
|
|
|
this.updateTopLevel();
|
|
|
|
this.updateNavigation();
|
2024-08-23 12:42:32 +00:00
|
|
|
},
|
|
|
|
beforeUnmount() {
|
|
|
|
this.resetNavigation();
|
|
|
|
},
|
|
|
|
methods: {
|
2024-09-01 17:19:48 +00:00
|
|
|
...mapActions(useNavigationStore, ["resetNavigation", "updateTopLevel", "updateNavigation"]),
|
2024-08-23 12:42:32 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|