MenuScroll.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: "détails" },
  23. { label: "abonnement" },
  24. { label: "Temoignages" },
  25. { label: "formations" },
  26. { label: "Aide" },
  27. ];
  28. const activeMenu = ref(menus[0].label);
  29. const navigate = (menu) => {
  30. activeMenu.value = menu.label;
  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>