Navigation.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div>
  3. <v-navigation-drawer
  4. v-model="drawer"
  5. app
  6. temporary
  7. dark
  8. src="@/assets/img/bgDrawer.jpg"
  9. >
  10. <v-list>
  11. <v-list-item>
  12. <v-list-item-avatar>
  13. <img src="@/assets/img/logo.png" alt="Logo" />
  14. </v-list-item-avatar>
  15. <v-list-item-content>
  16. <v-list-item-title class="title">Calango</v-list-item-title>
  17. <v-list-item-subtitle>WEB</v-list-item-subtitle>
  18. </v-list-item-content>
  19. </v-list-item>
  20. </v-list>
  21. <v-divider />
  22. <v-list dense>
  23. <v-list-item
  24. v-for="([icon, text, link], i) in items"
  25. :key="i"
  26. link
  27. @click="$vuetify.goTo(link)"
  28. >
  29. <v-list-item-icon class="justify-center">
  30. <v-icon>{{ icon }}</v-icon>
  31. </v-list-item-icon>
  32. <v-list-item-content>
  33. <v-list-item-title class="subtitile-1">{{
  34. text
  35. }}</v-list-item-title>
  36. </v-list-item-content>
  37. </v-list-item>
  38. </v-list>
  39. </v-navigation-drawer>
  40. <v-app-bar
  41. app
  42. :color="color"
  43. :flat="flat"
  44. dark
  45. class="px-15"
  46. :class="{ expand: flat }"
  47. >
  48. <v-toolbar-title>
  49. <v-img src="@/assets/img/logo.png" max-width="50px" />
  50. </v-toolbar-title>
  51. <v-spacer />
  52. <v-app-bar-nav-icon
  53. @click.stop="drawer = !drawer"
  54. class="mr-4"
  55. v-if="isXs"
  56. />
  57. <div v-else>
  58. <v-btn text @click="$vuetify.goTo('#home')">
  59. <span class="mr-2">Home</span>
  60. </v-btn>
  61. <v-btn text @click="$vuetify.goTo('#features')">
  62. <span class="mr-2">Products</span>
  63. </v-btn>
  64. <v-btn text @click="$vuetify.goTo('#about')">
  65. <span class="mr-2">About Us</span>
  66. </v-btn>
  67. <v-btn text @click="$vuetify.goTo('#pricing')">
  68. <span class="mr-2">Blog</span>
  69. </v-btn>
  70. <v-btn rounded outlined text @click="$vuetify.goTo('#contact')">
  71. <span class="mr-2">Contact Us</span>
  72. </v-btn>
  73. </div>
  74. </v-app-bar>
  75. </div>
  76. </template>
  77. <style scoped>
  78. .v-toolbar {
  79. transition: 0.6s;
  80. }
  81. .expand {
  82. height: 80px !important;
  83. padding-top: 10px;
  84. }
  85. </style>
  86. <script>
  87. export default {
  88. data: () => ({
  89. drawer: null,
  90. isXs: false,
  91. items: [
  92. ["mdi-home-outline", "Home", "#home"],
  93. ["mdi-information-outline", "Sobre", "#features"],
  94. ["mdi-download-box-outline", "Download", "#download"],
  95. ["mdi-currency-usd", "Preços", "#pricing"],
  96. ["mdi-email-outline", "Contatos", "#contact"],
  97. ],
  98. }),
  99. props: {
  100. color: String,
  101. flat: Boolean,
  102. },
  103. methods: {
  104. onResize() {
  105. this.isXs = window.innerWidth < 850;
  106. },
  107. },
  108. watch: {
  109. isXs(value) {
  110. if (!value) {
  111. if (this.drawer) {
  112. this.drawer = false;
  113. }
  114. }
  115. },
  116. },
  117. mounted() {
  118. this.onResize();
  119. window.addEventListener("resize", this.onResize, { passive: true });
  120. },
  121. };
  122. </script>