2025-09-23 14:18:04 +02:00
|
|
|
<template>
|
2025-10-03 16:51:44 +02:00
|
|
|
<component :is="layoutComponent">
|
|
|
|
|
<RouterView />
|
|
|
|
|
</component>
|
2025-09-23 14:18:04 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2025-10-03 16:51:44 +02:00
|
|
|
import { RouterView, useRoute } from 'vue-router';
|
2025-09-23 14:18:04 +02:00
|
|
|
import type { LayoutName } from '@/types/router';
|
|
|
|
|
|
|
|
|
|
import DefaultLayout from '@/layouts/DefaultLayout.vue';
|
|
|
|
|
import NavbarLayout from '@/layouts/NavbarLayout.vue';
|
|
|
|
|
|
|
|
|
|
const layouts = {
|
|
|
|
|
DefaultLayout,
|
2025-10-03 16:51:44 +02:00
|
|
|
NavbarLayout,
|
2025-09-23 14:18:04 +02:00
|
|
|
};
|
|
|
|
|
|
2025-10-03 16:51:44 +02:00
|
|
|
import { computed } from 'vue';
|
2025-09-23 14:18:04 +02:00
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
|
|
|
|
|
const layoutComponent = computed(() => {
|
|
|
|
|
const layoutName: LayoutName = route.meta.layout ?? 'DefaultLayout';
|
|
|
|
|
return layouts[layoutName]; // Jetzt kennt TypeScript den Typ!
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="sass">
|
|
|
|
|
footer
|
|
|
|
|
margin-top: auto
|
2025-10-03 16:51:44 +02:00
|
|
|
</style>
|