headerSection.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div>
  3. <div class="headerSection">
  4. <div class="header-container width1200">
  5. <router-link :to="{ path: '/' }"
  6. class="logo">
  7. <img src="../assets/images/logo.png"
  8. width="136px"
  9. height="40px"
  10. alt="">
  11. </router-link>
  12. <div class="menu">
  13. <router-link :class="checkActive==1?'active':''"
  14. @click.native="change(1)"
  15. :to="{ path: '/' }">首页</router-link>
  16. <router-link :class="checkActive==2?'active':''"
  17. @click.native="change(2)"
  18. :to="{ path: '/brand' }">产品</router-link>
  19. <router-link :class="checkActive==3?'active':''"
  20. @click.native="change(3)"
  21. :to="{ path: '/consult' }">咨询</router-link>
  22. <router-link :class="checkActive==4?'active':''"
  23. @click.native="change(4)"
  24. :to="{ path: '/aboutUs' }">关于我们</router-link>
  25. <div class="bandBtn">合作机构</div>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="wall"></div>
  30. </div>
  31. </template>
  32. <script>
  33. export default {
  34. name: 'headerSection',
  35. props: ['name'],
  36. data () {
  37. return {
  38. checkActive: 1
  39. }
  40. },
  41. methods: {
  42. change (num) {
  43. this.checkActive = num;
  44. }
  45. }
  46. }
  47. </script>
  48. <style lang="less" scoped>
  49. .bandBtn {
  50. width: 112px;
  51. height: 30px;
  52. background: #2dc7aa;
  53. border-radius: 4px;
  54. color: #fff;
  55. margin-left: 70px;
  56. line-height: 30px;
  57. cursor: pointer;
  58. position: relative;
  59. top: 8px;
  60. }
  61. .wall {
  62. height: 82px;
  63. }
  64. .headerSection {
  65. background-color: #fff;
  66. position: fixed;
  67. width: 100%;
  68. top: 0px;
  69. z-index: 1000;
  70. .header-container {
  71. margin: 0 auto;
  72. // overflow: hidden;
  73. display: flex;
  74. flex-direction: row;
  75. justify-content: space-between;
  76. height: 80px;
  77. padding-top: 17px;
  78. }
  79. .logo {
  80. // float: left;
  81. width: 159px;
  82. height: 48px;
  83. }
  84. .menu {
  85. display: flex;
  86. flex-direction: row;
  87. font-size: 16px;
  88. a {
  89. margin-left: 80px;
  90. color: #565757;
  91. line-height: 48px;
  92. text-decoration: none;
  93. position: relative;
  94. // display: block;
  95. text-decoration: none;
  96. text-transform: uppercase;
  97. transition: 0.5s;
  98. &::after {
  99. position: absolute;
  100. content: "";
  101. top: 60%;
  102. left: 0;
  103. width: 100%;
  104. height: 3px;
  105. background-color: #000;
  106. z-index: 100;
  107. transform: scaleX(0);
  108. transform-origin: right;
  109. transition: transform 0.5s;
  110. }
  111. &:hover,
  112. &.hover {
  113. color: #000000;
  114. font-weight: 600;
  115. }
  116. &:hover::after {
  117. transform: scaleX(1);
  118. transform-origin: left;
  119. }
  120. }
  121. }
  122. a.active {
  123. color: #000 !important;
  124. font-weight: 600;
  125. &::after {
  126. position: absolute;
  127. content: "";
  128. top: 60%;
  129. left: 0;
  130. width: 100%;
  131. height: 3px;
  132. background-color: #000;
  133. z-index: 100;
  134. transform: scaleX(1);
  135. transform-origin: left;
  136. }
  137. }
  138. }
  139. </style>