fucking props!

This commit is contained in:
Sockenklaus
2023-07-02 19:56:51 +02:00
parent bc38291696
commit bf92a1ed9a
6 changed files with 47 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<LoginLayout> <LoginLayout>
<MainNav /> <MainNav :route="props.route" />
<slot></slot> <slot />
</LoginLayout> </LoginLayout>
</template> </template>
@@ -9,4 +9,8 @@
<script setup> <script setup>
import LoginLayout from '@/layouts/LoginLayout' import LoginLayout from '@/layouts/LoginLayout'
import MainNav from '@/components/MainNav' import MainNav from '@/components/MainNav'
const props = defineProps({
route: String
})
</script> </script>

View File

@@ -4,7 +4,7 @@
<script setup> <script setup>
import { Link } from '@inertiajs/vue3' import { Link } from '@inertiajs/vue3'
import { h, ref } from 'vue'; import { h, ref, defineProps } from 'vue';
import { NIcon, NButton } from 'naive-ui' import { NIcon, NButton } from 'naive-ui'
import { import {
GroupsFilled as Users, GroupsFilled as Users,
@@ -12,43 +12,45 @@
LogOutFilled as Logout LogOutFilled as Logout
} from '@vicons/material' } from '@vicons/material'
const activeKey = ref(null) const props = defineProps(['route'])
const activeKey = ref(props.route)
const menuOptions = ref([ const menuOptions = ref([
{ {
label: () => label: () =>
h( h(
Link, { Link, {
href: "/Events", href: "/events",
methode: "get" methode: "get"
}, },
"Veranstaltungen" "Veranstaltungen"
), ),
key: 'go-to-events', key: '/events',
icon: renderIcon(Events) icon: renderIcon(Events)
}, },
{ {
label: () => label: () =>
h( h(
Link, { Link, {
href: "/Users", href: "/users",
method: "get" method: "get"
}, },
"Benutzer" "Benutzer"
), ),
key: 'go-to-users', key: '/users',
icon: renderIcon(Users) icon: renderIcon(Users)
}, },
{ {
label: () => label: () =>
h( h(
Link, { Link, {
href: "/Login", href: "/login",
method: "get" method: "get"
}, },
"Abmelden" "Abmelden"
), ),
key: 'go-to-logout', key: '/logout',
icon: renderIcon(Logout) icon: renderIcon(Logout)
} }
]) ])

View File

@@ -1,12 +1,31 @@
<template> <template>
<div>test</div>
<div>{{route}}</div>
</template> </template>
<script setup> <script setup>
import BELayout from '@/layouts/BELayout.vue' import BELayout from '@/layouts/BELayout.vue'
import MainNav from '@/components/MainNav.vue'
defineOptions({ layout: BELayout }) //const props = defineProps(['route'])
defineOptions({
layout: (h, page) => h(BELayout, {
props: {
route: route
}
}, [page])
})
</script> </script>
<script>
import BELayout from '@/layouts/BELayout.vue'
import { h } from 'vue'
export default {
props: {
route: String
}
}
</script>

View File

@@ -35,7 +35,7 @@
function onClickLogin(){ function onClickLogin(){
router.get( router.get(
'/Events' '/events'
) )
} }
</script> </script>

View File

@@ -1,5 +1,5 @@
<template> <template>
kajsdkjahsdkjhs
</template> </template>
<script setup> <script setup>

View File

@@ -24,14 +24,15 @@ Route.get('/', async ({ inertia }) => {
return inertia.render('Home') return inertia.render('Home')
}) })
Route.get('/Login', async({inertia}) =>{ Route.get('/login', async({inertia}) =>{
return inertia.render('Login') return inertia.render('Login')
}) })
Route.get('/Events', async({inertia})=> { Route.get('/events', async({ inertia, request }) => {
return inertia.render('Events/EventsList') return inertia.render('Events/EventsList', {
route: request.url() })
}) })
Route.get('/Users', async({inertia}) => { Route.get('/users', async({inertia}) => {
return inertia.render('Users/UsersList') return inertia.render('Users/UsersList')
}) })