Nav.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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/ABC" class="item">
  40. <span>品牌墙</span>
  41. </nuxt-link>
  42. <nuxt-link to="/news" class="item">
  43. <span>优软快讯</span>
  44. </nuxt-link>
  45. </div>
  46. </nav>
  47. </template>
  48. <script>
  49. export default {
  50. name: 'navView',
  51. data () {
  52. return {
  53. isMounted: false
  54. }
  55. },
  56. mounted () {
  57. this.$nextTick(() => {
  58. this.isMounted = true
  59. })
  60. },
  61. computed: {
  62. name () {
  63. let path = this.$route.path
  64. if (path === '/provider/factories') {
  65. return '原厂专区'
  66. } else if (path === '/provider/home') {
  67. return '代理经销'
  68. } else {
  69. return '店 铺'
  70. }
  71. },
  72. isActive () {
  73. return (this.$route.path === '/provider/factories' && this.name === '原厂专区') || (this.$route.path === '/provider/home' && this.name === '代理经销')
  74. }
  75. },
  76. methods: {
  77. open (url) {
  78. window.open(url)
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. @import '~assets/scss/variables';
  85. $nav-height: 40px;
  86. .nav-list a span{
  87. font-size: 14px;
  88. }
  89. .nav-list {
  90. background-color: rgb(244, 248, 255);
  91. height: $nav-height;
  92. .item {
  93. display: inline-block;
  94. height: $nav-height;
  95. line-height: $nav-height;
  96. width: 126px;
  97. text-align: center;
  98. margin: 0;
  99. vertical-align: middle;
  100. color: $black-light;
  101. > span {
  102. padding: 5px 2px;
  103. }
  104. &.nuxt-link-active, &.active, &:not(.expand-item):hover {
  105. > span {
  106. color: #5078cb;
  107. border-bottom: #5078cb 3px solid;
  108. font-weight: bold;
  109. }
  110. }
  111. &.expand-item {
  112. position: relative;
  113. .expand-list {
  114. z-index: 10;
  115. position: absolute;
  116. left: 8px;
  117. top: 40px;
  118. background: #fff;
  119. width: 106px;
  120. border-radius: 2px;
  121. display: none;
  122. -webkit-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  123. -moz-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  124. box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  125. li {
  126. height: 34px;
  127. line-height: 34px;
  128. text-align: center;
  129. span {
  130. color: #666;
  131. }
  132. &:hover {
  133. background: #5078cb;
  134. span {
  135. color: #fff;
  136. }
  137. }
  138. }
  139. }
  140. .icon-arrow-up {
  141. display: none;
  142. }
  143. &:hover {
  144. color: #2147f9;
  145. .expand-list {
  146. display: block;
  147. }
  148. .icon-arrow-up {
  149. display: inline-block;
  150. }
  151. .icon-arrow-down {
  152. display: none;
  153. }
  154. }
  155. }
  156. &.item-first {
  157. width: 200px;
  158. margin: 0;
  159. background-color: rgb(33, 71, 151);
  160. font-size: 14px;
  161. font-weight: bold;
  162. text-align: center;
  163. color: #fff;
  164. cursor: pointer;
  165. }
  166. }
  167. }
  168. </style>