Menu.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 max-height="300">
  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-list dense :subheader="true">
  39. <v-list-item dense class="ot_light_grey">
  40. <v-list-item-title v-text="$t(menu.title)" />
  41. </v-list-item>
  42. <template v-for="(item, index) in menu.children">
  43. <v-list-item
  44. :key="item.title"
  45. :href="item.isExternalLink ? item.to : undefined"
  46. :to="!item.isExternalLink ? item.to : undefined"
  47. router
  48. exact
  49. >
  50. <v-list-item-title v-text="$t(item.title)" />
  51. </v-list-item>
  52. <v-divider
  53. v-if="index < menu.length - 1"
  54. :key="index"
  55. />
  56. </template>
  57. </v-list>
  58. </v-menu>
  59. </template>
  60. <script lang="ts">
  61. import { defineComponent } from '@nuxtjs/composition-api'
  62. export default defineComponent({
  63. props: {
  64. menu: {
  65. type: Object,
  66. required: true
  67. },
  68. avatar: {
  69. type: Boolean,
  70. required: false
  71. }
  72. }
  73. })
  74. </script>