Nav.vue 4.9 KB

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