Menu.vue 2.6 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 v-slot:activator="{ on: { click }, attrs }">
  8. <v-tooltip bottom>
  9. <template v-slot:activator="{ on: on_tooltips , attrs: attrs_tooltips }">
  10. <v-avatar
  11. v-if="avatar"
  12. size="30"
  13. v-bind="[attrs, attrs_tooltips]"
  14. v-on="on_tooltips"
  15. @click="click"
  16. >
  17. <img
  18. src="https://cdn.vuetifyjs.com/images/john.jpg"
  19. alt="John"
  20. >
  21. </v-avatar>
  22. <v-btn
  23. v-else
  24. icon
  25. v-bind="[attrs, attrs_tooltips]"
  26. color=""
  27. v-on="on_tooltips"
  28. @click="click"
  29. >
  30. <v-icon class="ot_white--text" small>
  31. {{ menu.icon }}
  32. </v-icon>
  33. </v-btn>
  34. </template>
  35. <span>{{ $t(menu.title) }}</span>
  36. </v-tooltip>
  37. </template>
  38. <v-card scrollable>
  39. <v-card-title class="ot_super_light_grey text-body-2 font-weight-bold">
  40. {{$t(menu.title)}}
  41. </v-card-title>
  42. <v-card-text style="max-height: 300px; overflow-y: scroll" class="ma-0 pa-0">
  43. <v-list dense :subheader="true">
  44. <template v-for="(item, index) in menu.children">
  45. <v-list-item
  46. :id="item.title"
  47. :key="item.title"
  48. :href="item.isExternalLink ? item.to : undefined"
  49. :to="!item.isExternalLink ? item.to : undefined"
  50. router
  51. exact
  52. >
  53. <v-list-item-title v-text="$t(item.title)"/>
  54. </v-list-item>
  55. </template>
  56. </v-list>
  57. </v-card-text>
  58. <v-card-actions class="ma-0 pa-0">
  59. <template v-for="(item, index) in menu.actions">
  60. <v-list-item
  61. class="text-body-2"
  62. :id="item.title"
  63. :key="item.title"
  64. :href="item.isExternalLink ? item.to : undefined"
  65. :to="!item.isExternalLink ? item.to : undefined"
  66. router
  67. >
  68. <v-list-item-title v-text="$t(item.title)"/>
  69. </v-list-item>
  70. </template>
  71. </v-card-actions>
  72. </v-card>
  73. </v-menu>
  74. </template>
  75. <script lang="ts">
  76. import {defineComponent} from '@nuxtjs/composition-api'
  77. export default defineComponent({
  78. props: {
  79. menu: {
  80. type: Object,
  81. required: true
  82. },
  83. avatar: {
  84. type: Boolean,
  85. required: false
  86. }
  87. }
  88. })
  89. </script>
  90. <style scoped>
  91. #logout{
  92. background: var(--v-ot_green-base, white);
  93. color: white;
  94. }
  95. </style>