Sépare le menu dans un composant dédié
This commit is contained in:
parent
132383122a
commit
f47ddff911
@ -1,12 +1,6 @@
|
||||
<template>
|
||||
<v-app-bar :elevation="12">
|
||||
<v-app-bar-nav-icon v-on:click="menu = !menu"></v-app-bar-nav-icon>
|
||||
<v-menu v-model="menu" class="menu-below-bar">
|
||||
<v-list>
|
||||
<v-list-item v-for="route in routes" :key="route.name" :to="route.path">{{ route.name }}</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
|
||||
<RouterMenu />
|
||||
<v-app-bar-title>Brain Blast</v-app-bar-title>
|
||||
|
||||
<template v-slot:append>
|
||||
@ -16,24 +10,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useTheme } from 'vuetify'
|
||||
import { useRouter } from 'vue-router';
|
||||
import RouterMenu from '@/components/RouterMenu.vue'
|
||||
|
||||
const theme = useTheme()
|
||||
const router = useRouter();
|
||||
const routes = router.options.routes;
|
||||
|
||||
let menu = ref(false)
|
||||
|
||||
function toggleTheme () {
|
||||
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark'
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.menu-below-bar {
|
||||
margin-top: 48px; /* La hauteur de la barre d'application */
|
||||
}
|
||||
</style>
|
||||
|
24
src/components/RouterMenu.vue
Normal file
24
src/components/RouterMenu.vue
Normal file
@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<v-app-bar-nav-icon v-on:click="menu = !menu"></v-app-bar-nav-icon>
|
||||
<v-menu v-model="menu" class="menu-below-bar">
|
||||
<v-list>
|
||||
<v-list-item v-for="route in routes" :key="route.name" :to="route.path">{{ route.name }}</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const routes = router.options.routes
|
||||
|
||||
let menu = ref(false)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.menu-below-bar {
|
||||
margin-top: 48px; /* La hauteur de la barre d'application */
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user