MenuScroll.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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: 'Comparatif' },
  21. { label: 'détails' },
  22. { label: 'abonnement' },
  23. { label: 'témoignages' },
  24. { label: 'formations' },
  25. { label: 'solutions' }
  26. ];
  27. const activeMenu = ref(menus[0].label);
  28. const navigate = (menu) => {
  29. activeMenu.value = menu.label;
  30. const element = document.getElementById(menu.label);
  31. if (element) {
  32. element.scrollIntoView({ behavior: "smooth" });
  33. }
  34. };
  35. </script>
  36. <style scoped>
  37. .menu-container {
  38. display: flex;
  39. justify-content: space-around;
  40. padding: 1rem 10rem;
  41. background: white;
  42. color: #bbb8b8;
  43. font-family: "Barlow";
  44. font-size: 12px;
  45. line-height: 16px;
  46. display: flex;
  47. align-items: center;
  48. text-align: center;
  49. letter-spacing: 0.18em;
  50. text-transform: uppercase;
  51. border-bottom: 0.1rem solid #eaeaea;
  52. }
  53. .v-chip.active-menu {
  54. background: black;
  55. color: white;
  56. }
  57. .menu-container div:hover {
  58. cursor: pointer;
  59. text-decoration: underline;
  60. }
  61. </style>