MenuScroll.vue 1.6 KB

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