Menu.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!--
  2. Menu principal de l'application
  3. Prend en paramètre une liste de ItemMenu et les met en forme
  4. -->
  5. <template>
  6. <v-navigation-drawer
  7. :mini-variant.sync="miniVariant"
  8. clipped
  9. class="ot_dark_grey ot_menu_color--text"
  10. fixed
  11. app
  12. >
  13. <v-list>
  14. <div v-for="(item, i) in menu" :key="i">
  15. <v-list-item
  16. v-if="!item.children"
  17. :href="item.isExternalLink ? item.to : undefined"
  18. :to="!item.isExternalLink ? item.to : undefined"
  19. router
  20. exact
  21. >
  22. <v-list-item-action>
  23. <v-icon class="ot_menu_color--text" small>
  24. {{ item.icon }}
  25. </v-icon>
  26. </v-list-item-action>
  27. <v-list-item-content>
  28. <v-list-item-title class="ot_menu_color--text" v-text="$t(item.title)" />
  29. </v-list-item-content>
  30. </v-list-item>
  31. <v-list-group
  32. v-else
  33. v-model="item.active"
  34. no-action
  35. >
  36. <template #activator>
  37. <v-list-item-action>
  38. <v-icon class="ot_menu_color--text" small>
  39. {{ item.icon }}
  40. </v-icon>
  41. </v-list-item-action>
  42. <v-list-item-content>
  43. <v-list-item-title class="ot_menu_color--text" v-text="$t(item.title)" />
  44. </v-list-item-content>
  45. </template>
  46. <v-list-item
  47. v-for="child in item.children"
  48. :key="child.title"
  49. :href="child.isExternalLink ? child.to : undefined"
  50. :to="!child.isExternalLink ? child.to : undefined"
  51. router
  52. exact
  53. >
  54. <v-list-item-action>
  55. <v-icon class="ot_menu_color--text" small>
  56. {{ child.icon }}
  57. </v-icon>
  58. </v-list-item-action>
  59. <v-list-item-content>
  60. <v-list-item-title class="ot_menu_color--text" v-text="$t(child.title)" />
  61. </v-list-item-content>
  62. </v-list-item>
  63. </v-list-group>
  64. </div>
  65. </v-list>
  66. </v-navigation-drawer>
  67. </template>
  68. <script lang="ts">
  69. import { defineComponent } from '@nuxtjs/composition-api'
  70. import { ItemsMenu } from '~/types/interfaces'
  71. export default defineComponent({
  72. props: {
  73. menu: {
  74. type: Array as () => ItemsMenu,
  75. required: true
  76. },
  77. miniVariant: {
  78. type: Boolean,
  79. required: true
  80. }
  81. }
  82. })
  83. </script>
  84. <style scoped>
  85. .v-list-item__action, .v-list-group__header__prepend-icon {
  86. margin-right: 10px !important;
  87. }
  88. .v-application--is-ltr .v-list-group--no-action > .v-list-group__items > .v-list-item {
  89. padding-left: 30px;
  90. }
  91. .v-list-item__title {
  92. font-size: 14px;
  93. }
  94. .v-list-item {
  95. min-height: 10px !important;
  96. }
  97. .v-list-item__action {
  98. margin: 10px 0;
  99. }
  100. .v-list-item__content {
  101. padding: 8px 0;
  102. }
  103. .home_menu {
  104. font-size: 23px;
  105. }
  106. </style>