Nav.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <nav class="nav-list">
  3. <div class="container">
  4. <nuxt-link to="/product/kind/home" class="item item-first">
  5. <div>器件选型</div>
  6. </nuxt-link>
  7. <nuxt-link :to="'/'" class="item" exact>
  8. <span>首&nbsp;&nbsp;页</span>
  9. </nuxt-link>
  10. <nuxt-link to="/applyPurchase" class="item">
  11. <span>询价求购</span>
  12. <img class="new-animate" src="/images/all/banner-cuxiao03.png" alt="">
  13. </nuxt-link>
  14. <nuxt-link to="/supplier" class="item">
  15. <span>供应商</span>
  16. </nuxt-link>
  17. <nuxt-link to="/btbBusiness" class="item">
  18. <span>B2B商务</span>
  19. <img class="new-animate" src="/images/all/hot.png" alt="">
  20. </nuxt-link>
  21. <a class="item expand-item" :class="{'active': isActive}">
  22. <span>{{name}}
  23. <i class="iconfont icon-arrow-down"></i>
  24. <i class="iconfont icon-arrow-up"></i>
  25. </span>
  26. <ul class="expand-list" v-if="isMounted">
  27. <nuxt-link to="/provider/factories" tag="li" v-show="name !== '原厂专区'">
  28. <!--<nuxt-link to="/provider/factories">原厂专区</nuxt-link>-->
  29. <span>原厂专区</span>
  30. </nuxt-link>
  31. <nuxt-link to="/provider/home" tag="li" v-show="name !== '代理经销'">
  32. <span>代理经销</span>
  33. </nuxt-link>
  34. <li @click="open('/store/33069557578d44e69bd91ad12d28a8d4')">
  35. <span>优软寄售</span>
  36. </li>
  37. </ul>
  38. </a>
  39. <nuxt-link to="/product/brand/brandList/A" class="item">
  40. <span>品牌墙</span>
  41. </nuxt-link>
  42. <nuxt-link to="/pcb" class="item">
  43. <span>pcb专区</span>
  44. </nuxt-link>
  45. <nuxt-link to="/news" class="item">
  46. <span>优软快讯</span>
  47. </nuxt-link>
  48. </div>
  49. </nav>
  50. </template>
  51. <script>
  52. export default {
  53. name: 'navView',
  54. data () {
  55. return {
  56. isMounted: false
  57. }
  58. },
  59. mounted () {
  60. this.$nextTick(() => {
  61. this.isMounted = true
  62. })
  63. },
  64. computed: {
  65. name () {
  66. let path = this.$route.path
  67. if (path === '/provider/factories') {
  68. return '原厂专区'
  69. } else if (path === '/provider/home') {
  70. return '代理经销'
  71. } else {
  72. return '店 铺'
  73. }
  74. },
  75. isActive () {
  76. return (this.$route.path === '/provider/factories' && this.name === '原厂专区') || (this.$route.path === '/provider/home' && this.name === '代理经销')
  77. }
  78. },
  79. methods: {
  80. open (url) {
  81. window.open(url)
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. @import '~assets/scss/variables';
  88. $nav-height: 40px;
  89. .nav-list a span{
  90. font-size: 14px;
  91. }
  92. .nav-list {
  93. background-color: rgb(244, 248, 255);
  94. height: $nav-height;
  95. .item {
  96. display: inline-block;
  97. height: $nav-height;
  98. line-height: $nav-height;
  99. width: 122px;
  100. text-align: center;
  101. margin: 0;
  102. vertical-align: middle;
  103. color: $black-light;
  104. > span {
  105. padding: 5px 2px;
  106. }
  107. &.nuxt-link-active, &.active, &:not(.expand-item):hover {
  108. > span {
  109. color: #5078cb;
  110. border-bottom: #5078cb 3px solid;
  111. font-weight: bold;
  112. }
  113. }
  114. &.expand-item {
  115. position: relative;
  116. .expand-list {
  117. z-index: 10;
  118. position: absolute;
  119. left: 8px;
  120. top: 40px;
  121. background: #fff;
  122. width: 106px;
  123. border-radius: 2px;
  124. display: none;
  125. -webkit-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  126. -moz-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  127. box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  128. li {
  129. height: 34px;
  130. line-height: 34px;
  131. text-align: center;
  132. span {
  133. color: #666;
  134. }
  135. &:hover {
  136. background: #5078cb;
  137. span {
  138. color: #fff;
  139. }
  140. }
  141. }
  142. }
  143. .icon-arrow-up {
  144. display: none;
  145. }
  146. &:hover {
  147. color: #2147f9;
  148. .expand-list {
  149. display: block;
  150. }
  151. .icon-arrow-up {
  152. display: inline-block;
  153. }
  154. .icon-arrow-down {
  155. display: none;
  156. }
  157. }
  158. }
  159. &.item-first {
  160. width: 200px;
  161. margin: 0;
  162. background-color: rgb(33, 71, 151);
  163. font-size: 14px;
  164. font-weight: bold;
  165. text-align: center;
  166. color: #fff;
  167. cursor: pointer;
  168. }
  169. }
  170. }
  171. </style>