MenuScroll.vue 1.5 KB

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