| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <!--
- Menu principal de l'application
- Prend en paramètre une liste de ItemMenu et les met en forme
- -->
- <template>
- <v-navigation-drawer
- :mini-variant.sync="miniVariant"
- v-model="open"
- fixed
- clipped
- class="ot_dark_grey ot_menu_color--text"
- app
- >
- <v-list class="left-menu">
- <div v-for="(item, i) in menu" :key="i">
- <v-list-item
- v-if="!item.children"
- :href="item.isExternalLink ? item.to : undefined"
- :to="!item.isExternalLink ? item.to : undefined"
- router
- exact
- >
- <v-list-item-action>
- <v-icon class="ot_menu_color--text" small>
- {{ item.icon }}
- </v-icon>
- </v-list-item-action>
- <v-list-item-content>
- <v-list-item-title class="ot_menu_color--text" v-text="$t(item.title)" />
- </v-list-item-content>
- </v-list-item>
- <v-list-group
- v-else
- v-model="item.active"
- no-action
- >
- <template #activator>
- <v-list-item-action>
- <v-icon class="ot_menu_color--text" small>
- {{ item.icon }}
- </v-icon>
- </v-list-item-action>
- <v-list-item-content>
- <v-list-item-title class="ot_menu_color--text" v-text="$t(item.title)" />
- </v-list-item-content>
- </template>
- <v-list-item
- v-for="child in item.children"
- :key="child.title"
- :href="child.isExternalLink ? child.to : undefined"
- :to="!child.isExternalLink ? child.to : undefined"
- router
- exact
- >
- <v-list-item-action>
- <v-icon class="ot_white--text" small>
- {{ child.icon }}
- </v-icon>
- </v-list-item-action>
- <v-list-item-content>
- <v-list-item-title class="ot_white--text" v-text="$t(child.title)" />
- </v-list-item-content>
- </v-list-item>
- <template #appendIcon>
- <v-icon class="ot_menu_color--text" small>mdi-chevron-down</v-icon>
- </template>
- </v-list-group>
- </div>
- </v-list>
- </v-navigation-drawer>
- </template>
- <script lang="ts">
- import {computed, defineComponent, onUnmounted, ref, toRefs, watch} from '@nuxtjs/composition-api'
- import { ItemsMenu } from '~/types/interfaces'
- import {WatchStopHandle} from "@vue/composition-api";
- export default defineComponent({
- props: {
- menu: {
- type: Array as () => ItemsMenu,
- required: true
- },
- miniVariant: {
- type: Boolean,
- required: true
- },
- openMenu: {
- type: Boolean,
- required: true
- }
- },
- setup(props){
- const {openMenu} = toRefs(props)
- const open = ref(false)
- const unwatch: WatchStopHandle = watch(openMenu, (newValue, oldValue) => {
- open.value = true
- })
- onUnmounted(() => {
- unwatch()
- })
- return {
- open
- }
- }
- })
- </script>
- <style scoped>
- .v-list-item__action, .v-list-group__header__prepend-icon {
- margin-right: 10px !important;
- }
- .v-application--is-ltr .v-list-group--no-action > .v-list-group__header{
- margin-left: 0px;
- padding-left: 0px;
- }
- .v-application--is-ltr .v-list-group--no-action > .v-list-group__items > .v-list-item {
- padding-left: 30px;
- }
- .v-list-item__title {
- font-size: 14px;
- }
- .v-list-item {
- min-height: 10px !important;
- }
- .v-list-item__action {
- margin: 10px 0;
- }
- .v-list-item__content {
- padding: 8px 0;
- }
- .home_menu {
- font-size: 23px;
- }
- </style>
|