Menu.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <v-menu offset-y left max-height="300">
  3. <template v-slot:activator="{ on: { click }, attrs }">
  4. <v-tooltip bottom>
  5. <template v-slot:activator="{ on: on_tooltips , attrs: attrs_tooltips }">
  6. <v-avatar v-if="avatar"
  7. size="30"
  8. v-bind="[attrs, attrs_tooltips]"
  9. v-on="on_tooltips"
  10. v-on:click="click"
  11. >
  12. <img
  13. src="https://cdn.vuetifyjs.com/images/john.jpg"
  14. alt="John"
  15. >
  16. </v-avatar>
  17. <v-btn v-else
  18. icon
  19. v-bind="[attrs, attrs_tooltips]"
  20. v-on="on_tooltips"
  21. v-on:click="click"
  22. color=""
  23. >
  24. <v-icon class="ot_white--text" small>{{ menu.icon }}</v-icon>
  25. </v-btn>
  26. </template>
  27. <span>{{ $t(menu.title) }}</span>
  28. </v-tooltip>
  29. </template>
  30. <v-list dense :subheader="true">
  31. <v-list-item dense class="ot_light_grey">
  32. <v-list-item-title v-text="$t(menu.title)"></v-list-item-title>
  33. </v-list-item>
  34. <template v-for="(item, index) in menu.children">
  35. <v-list-item
  36. :key="item.title"
  37. :href="item.isExternalLink ? item.to : undefined"
  38. :to="!item.isExternalLink ? item.to : undefined"
  39. router
  40. exact
  41. >
  42. <v-list-item-title v-text="$t(item.title)"></v-list-item-title>
  43. </v-list-item>
  44. <v-divider
  45. v-if="index < menu.length - 1"
  46. :key="index"
  47. ></v-divider>
  48. </template>
  49. </v-list>
  50. </v-menu>
  51. </template>
  52. <script lang="ts">
  53. import {defineComponent} from '@nuxtjs/composition-api'
  54. export default defineComponent({
  55. props: {
  56. menu: {
  57. type: Object,
  58. required: true
  59. },
  60. avatar: {
  61. type: Boolean,
  62. required: false
  63. }
  64. }
  65. })
  66. </script>