MenuScroll.vue 1.5 KB

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