You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.2 KiB

2 years ago
  1. <template>
  2. <div class="CustomSrollActive-wrapper">
  3. <scrollactive
  4. ref="scrollactive"
  5. active-class="active"
  6. :offset="offset"
  7. :scrollOffset="offset"
  8. class="my-nav"
  9. >
  10. <template v-for="(item, index) in list">
  11. <a
  12. :key="index"
  13. v-if="item.isShow"
  14. :href="item.url"
  15. class="scrollactive-item"
  16. >{{ $t(item.name) }}</a
  17. ></template>
  18. </scrollactive>
  19. </div>
  20. </template>
  21. <script>
  22. export default {
  23. name: "CustomScrollActive",
  24. props: {
  25. list: {
  26. type: Array,
  27. },
  28. },
  29. data: () => ({
  30. offset: 140,
  31. scrollOffset: 140,
  32. }),
  33. methods: {},
  34. mounted() {
  35. if (this.$vuetify.breakpoint.smAndUp) {
  36. this.offset = 140;
  37. this.scrollOffset = 140;
  38. } else {
  39. this.offset = 120;
  40. this.scrollOffset = 120;
  41. }
  42. },
  43. };
  44. </script>
  45. <style lang="scss" scoped>
  46. .CustomSrollActive-wrapper {
  47. width: 100%;
  48. overflow: hidden;
  49. }
  50. .my-nav {
  51. display: flex;
  52. background-color: transparent;
  53. }
  54. .my-nav a.scrollactive-item {
  55. font-weight: 400;
  56. font-size: 18px;
  57. line-height: 23px;
  58. color: $Neutrals-300;
  59. padding: 18px 10px;
  60. text-decoration: none;
  61. white-space: nowrap;
  62. position: relative;
  63. margin-right: 8px;
  64. transition: all 0.3s liner;
  65. }
  66. .my-nav a.scrollactive-item.active {
  67. font-weight: 700;
  68. color: $primary-orange;
  69. transition: all 0.3s liner;
  70. &::after {
  71. content: "";
  72. display: block;
  73. width: 100%;
  74. height: 4px;
  75. border-radius: 10px;
  76. background-color: $primary-orange;
  77. position: absolute;
  78. left: 0;
  79. bottom: 0;
  80. }
  81. }
  82. @media (min-width: 1366px) {
  83. .my-nav {
  84. flex-direction: column;
  85. background-color: transparent;
  86. }
  87. .my-nav a.scrollactive-item {
  88. color: $Neutrals-300;
  89. padding: 12px 20px 12px 10px;
  90. margin-right: 0;
  91. margin-bottom: 10px;
  92. }
  93. .my-nav a.scrollactive-item.active {
  94. background-image: url("~/assets/img/Highlight.png");
  95. background-size: 18px 8px;
  96. background-position: left 10px center;
  97. padding-left: 58px;
  98. color: $Neutrals-500;
  99. &::after {
  100. display: none;
  101. }
  102. }
  103. }
  104. </style>