MenuScroll.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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: "détails" },
  35. { label: "abonnement" },
  36. { label: "Temoignages" },
  37. { label: "formations" },
  38. { label: "Aide" },
  39. ];
  40. const activeMenu = ref(menus[0].label);
  41. const navigate = (menu) => {
  42. activeMenu.value = menu.label;
  43. const element = document.getElementById(menu.label);
  44. if (element) {
  45. element.scrollIntoView({ behavior: "smooth" });
  46. }
  47. };
  48. </script>
  49. <style scoped>
  50. .menu-container {
  51. display: flex;
  52. justify-content: space-around;
  53. padding: 1rem 10rem;
  54. background: white;
  55. color: #bbb8b8;
  56. font-family: "Barlow";
  57. font-size: 12px;
  58. line-height: 16px;
  59. display: flex;
  60. align-items: center;
  61. text-align: center;
  62. letter-spacing: 0.18em;
  63. text-transform: uppercase;
  64. border-bottom: 0.1rem solid #eaeaea;
  65. }
  66. .v-chip.active-menu {
  67. background: black;
  68. color: white;
  69. }
  70. .menu-container div:hover {
  71. cursor: pointer;
  72. text-decoration: underline;
  73. }
  74. </style>