Nav.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. <a class="item" @click="goB2B">
  18. <span>B2B商务</span>
  19. <img class="new-animate" src="/images/all/hot.png" alt="">
  20. </a>
  21. <nuxt-link to="/provider/shop" class="item">
  22. <span>店铺
  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. <!--&lt;!&ndash;<nuxt-link to="/provider/factories">原厂专区</nuxt-link>&ndash;&gt;-->
  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. </nuxt-link>
  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. // this.$router.push(url)
  83. },
  84. goB2B () {
  85. if (this.user.logged) {
  86. window.location.href = `${process.env.uasUrl}/#/index`
  87. } else {
  88. this.$router.push('/btbBusiness')
  89. }
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. @import '~assets/scss/variables';
  96. $nav-height: 40px;
  97. .nav-list a span{
  98. font-size: 14px;
  99. }
  100. .nav-list {
  101. background-color: rgb(244, 248, 255);
  102. height: $nav-height;
  103. .item {
  104. display: inline-block;
  105. height: $nav-height;
  106. line-height: $nav-height;
  107. width: 121px;
  108. text-align: center;
  109. margin: 0;
  110. vertical-align: middle;
  111. color: $black-light;
  112. > span {
  113. padding: 5px 2px;
  114. }
  115. &.nuxt-link-active, &.active, &:not(.expand-item):hover {
  116. > span {
  117. color: #5078cb;
  118. border-bottom: #5078cb 3px solid;
  119. font-weight: bold;
  120. }
  121. }
  122. &.expand-item {
  123. position: relative;
  124. .expand-list {
  125. z-index: 10;
  126. position: absolute;
  127. left: 8px;
  128. top: 40px;
  129. background: #fff;
  130. width: 106px;
  131. border-radius: 2px;
  132. display: none;
  133. -webkit-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  134. -moz-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  135. box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  136. li {
  137. height: 34px;
  138. line-height: 34px;
  139. text-align: center;
  140. span {
  141. color: #666;
  142. }
  143. &:hover {
  144. background: #5078cb;
  145. span {
  146. color: #fff;
  147. }
  148. }
  149. }
  150. }
  151. .icon-arrow-up {
  152. display: none;
  153. }
  154. &:hover {
  155. color: #2147f9;
  156. .expand-list {
  157. display: block;
  158. }
  159. .icon-arrow-up {
  160. display: inline-block;
  161. }
  162. .icon-arrow-down {
  163. display: none;
  164. }
  165. }
  166. }
  167. &.item-first {
  168. width: 220px;
  169. margin: 0;
  170. background-color: rgb(33, 71, 151);
  171. font-size: 14px;
  172. font-weight: bold;
  173. text-align: center;
  174. color: #fff;
  175. cursor: pointer;
  176. }
  177. }
  178. }
  179. </style>