Menu.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!--
  2. Menu déroulant générique pour l'affichage des menus du
  3. header principal (configuration, paramètres du compte...)
  4. -->
  5. <template>
  6. <v-menu offset-y left>
  7. <template #activator="{ on: { click }, attrs }">
  8. <v-tooltip bottom>
  9. <template #activator="{ on: on_tooltips , attrs: attrs_tooltips }">
  10. <v-btn
  11. icon
  12. v-bind="[attrs, attrs_tooltips]"
  13. color=""
  14. v-on="on_tooltips"
  15. @click="click"
  16. >
  17. <v-avatar
  18. v-if="menu.icon.avatarByDefault"
  19. size="30"
  20. >
  21. <UiImage :id="menu.icon.avatarId" :imageByDefault="menu.icon.avatarByDefault" :width="30"></UiImage>
  22. </v-avatar>
  23. <v-icon v-else class="ot_white--text" small>
  24. {{ menu.icon.name }}
  25. </v-icon>
  26. </v-btn>
  27. </template>
  28. <span>{{ $t(menu.title) }}</span>
  29. </v-tooltip>
  30. </template>
  31. <v-card scrollable>
  32. <v-card-title class="ot_header_menu text-body-2 font-weight-bold">
  33. {{$t(menu.title)}}
  34. </v-card-title>
  35. <v-card-text class="ma-0 pa-0 header-menu">
  36. <v-list dense :subheader="true">
  37. <template v-for="(item, index) in menu.children">
  38. <v-list-item
  39. :id="item.title"
  40. :key="index"
  41. :href="item.isExternalLink ? item.to : undefined"
  42. :to="!item.isExternalLink ? item.to : undefined"
  43. router
  44. exact
  45. >
  46. <v-list-item-title>
  47. <span v-if="item.icon">
  48. <v-avatar
  49. v-if="item.icon.avatarByDefault"
  50. size="30"
  51. >
  52. <UiImage :id="item.icon.avatarId" :imageByDefault="item.icon.avatarByDefault" :width="30"></UiImage>
  53. </v-avatar>
  54. <v-icon v-else class="ot_white--text" small>
  55. {{ item.icon.name }}
  56. </v-icon>
  57. </span>
  58. <span>{{$t(item.title)}}</span>
  59. </v-list-item-title>
  60. </v-list-item>
  61. </template>
  62. </v-list>
  63. </v-card-text>
  64. <v-card-actions class="ma-0 pa-0">
  65. <template v-for="(item, index) in menu.actions">
  66. <v-list-item
  67. :id="item.title"
  68. :key="index"
  69. :href="item.isExternalLink ? item.to : undefined"
  70. :to="!item.isExternalLink ? item.to : undefined"
  71. router
  72. >
  73. <v-list-item-title class="text-body-2 ot_white--text" v-text="$t(item.title)"/>
  74. </v-list-item>
  75. </template>
  76. </v-card-actions>
  77. </v-card>
  78. </v-menu>
  79. </template>
  80. <script lang="ts">
  81. import {defineComponent, useContext} from '@nuxtjs/composition-api'
  82. import {accessState} from "~/types/interfaces";
  83. export default defineComponent({
  84. props: {
  85. menu: {
  86. type: Object,
  87. required: true
  88. }
  89. }
  90. })
  91. </script>
  92. <style scoped>
  93. #logout{
  94. background: var(--v-ot_green-base, white);
  95. color: white;
  96. }
  97. </style>