ff-admin/src/views/admin/View.vue

61 lines
1.7 KiB
Vue
Raw Normal View History

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>
<RoutingLink v-for="item in activeNavigationObject.top" :key="item.key" :link="item" />
</template>
<template #list>
<RoutingLink v-for="item in activeNavigationObject.main" :key="item.key" :link="item" />
</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";
import { useAbilityStore } from "../../stores/ability";
2024-09-01 17:19:48 +00:00
import RouterView from "../RouterView.vue";
2024-08-23 12:42:32 +00:00
</script>
<script lang="ts">
export default defineComponent({
props: {
contestId: {
type: String,
default: "",
},
},
computed: {
2024-09-01 17:19:48 +00:00
...mapState(useNavigationStore, ["activeNavigationObject", "activeTopLevelObject", "activeLink"]),
2024-08-23 12:42:32 +00:00
},
created() {
useAbilityStore().$subscribe(() => {
this.updateTopLevel();
this.updateNavigation();
});
2024-09-01 17:19:48 +00:00
this.updateTopLevel(true);
this.updateNavigation(true);
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>