routing inside url

This commit is contained in:
Julian Krauser 2024-09-01 19:19:48 +02:00
parent 2d0fb30558
commit 6247c385c3
15 changed files with 278 additions and 203 deletions

View file

@ -15,8 +15,7 @@
</SidebarTemplate>
</template>
<template #main>
<component v-if="display" :is="displayed" />
<div v-else class="w-full h-full bg-white rounded-lg"></div>
<RouterView />
</template>
</SidebarLayout>
</template>
@ -29,6 +28,7 @@ import SidebarLayout from "@/layouts/Sidebar.vue";
import SidebarTemplate from "@/templates/Sidebar.vue";
import RoutingLink from "@/components/admin/RoutingLink.vue";
import { useAbilityStore } from "../../stores/ability";
import RouterView from "../RouterView.vue";
</script>
<script lang="ts">
@ -40,44 +40,21 @@ export default defineComponent({
},
},
computed: {
...mapState(useNavigationStore, [
"activeNavigationObject",
"activeTopLevelObject",
"activeLink",
"componentOverwrite",
]),
display(): boolean {
return this.activeLink?.component || this.componentOverwrite;
},
displayed() {
if (this.componentOverwrite != null) {
return this.componentOverwrite;
} else {
return this.activeLink?.component;
}
},
...mapState(useNavigationStore, ["activeNavigationObject", "activeTopLevelObject", "activeLink"]),
},
created() {
useAbilityStore().$subscribe(() => {
this.updateTopLevel();
this.updateNavigation();
});
this.updateTopLevel();
this.updateNavigation();
this.setLink(this.activeTopLevelObject.levelDefault);
this.updateTopLevel(true);
this.updateNavigation(true);
},
beforeUnmount() {
this.resetNavigation();
},
methods: {
...mapActions(useNavigationStore, [
"setLink",
"resetNavigation",
"setTopLevel",
"updateTopLevel",
"updateNavigation",
]),
...mapActions(useNavigationStore, ["resetNavigation", "updateTopLevel", "updateNavigation"]),
},
});
</script>

View file

@ -0,0 +1,3 @@
<template>
<div class="w-full h-full bg-white rounded-md flex items-center justify-center">bitte auswählen</div>
</template>