MenuScroll.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <LayoutContainer>
  3. <v-row>
  4. <v-col
  5. cols="12"
  6. class="menu-container"
  7. >
  8. <div
  9. v-for="menu in menus"
  10. :key="menu.label"
  11. @click="navigate(menu)"
  12. >
  13. <v-chip
  14. v-if="activeMenu === menu.label"
  15. class="active-menu"
  16. >
  17. {{
  18. menu.label
  19. }}
  20. </v-chip>
  21. <span v-else>{{ menu.label }}</span>
  22. </div>
  23. </v-col>
  24. </v-row>
  25. </LayoutContainer>
  26. </template>
  27. <script setup>
  28. import { ref } from "vue";
  29. const menus = [
  30. { label: "Presentation" },
  31. { label: "Avantages" },
  32. { label: "Fonctionnalites" },
  33. { label: "Comparatif" },
  34. { label: "contact" },
  35. { label: "Temoignages" },
  36. { label: "formations" },
  37. { label: "Aide" },
  38. ];
  39. const activeMenu = ref(menus[0].label);
  40. const navigate = (menu) => {
  41. activeMenu.value = menu.label;
  42. const element = document.getElementById(menu.label);
  43. if (element) {
  44. element.scrollIntoView({ behavior: "smooth" });
  45. }
  46. };
  47. </script>
  48. <style scoped>
  49. .menu-container {
  50. display: flex;
  51. justify-content: space-around;
  52. padding: 1rem 10rem;
  53. background: white;
  54. color: #bbb8b8;
  55. font-family: "Barlow";
  56. font-size: 12px;
  57. line-height: 16px;
  58. display: flex;
  59. align-items: center;
  60. text-align: center;
  61. letter-spacing: 0.18em;
  62. text-transform: uppercase;
  63. border-bottom: 0.1rem solid #eaeaea;
  64. }
  65. .v-chip.active-menu {
  66. background: black;
  67. color: white;
  68. }
  69. .menu-container div:hover {
  70. cursor: pointer;
  71. text-decoration: underline;
  72. }
  73. </style>