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

View File

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

View File

@@ -1,12 +1,31 @@
<template>
<div>test</div>
<div>{{route}}</div>
</template>
<script setup>
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>
import BELayout from '@/layouts/BELayout.vue'
import { h } from 'vue'
export default {
props: {
route: String
}
}
</script>
</script>

View File

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

View File

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

View File

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