Nav.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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/' + 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. data () {
  58. return {
  59. pcbId: process.env.pcbId
  60. }
  61. },
  62. components: {
  63. KindCategory
  64. },
  65. methods: {
  66. loadProductKinds (id) {
  67. this.$store.dispatch('loadAllProductKinds', {id})
  68. },
  69. goB2B () {
  70. if (this.user.logged) {
  71. window.location.href = `${process.env.uasUrl}#/index`
  72. } else {
  73. this.login(`${process.env.uasUrl}`)
  74. }
  75. }
  76. },
  77. created () {
  78. this.$store.dispatch('loadProductKinds', { id: 0 })
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. @import '~assets/scss/variables';
  84. $nav-height: 40px;
  85. .nav-list a span{
  86. font-size: 14px;
  87. }
  88. .nav-list {
  89. background-color: rgb(244, 248, 255);
  90. height: $nav-height;
  91. .item {
  92. display: inline-block;
  93. height: $nav-height;
  94. line-height: $nav-height;
  95. width: 121px;
  96. text-align: center;
  97. margin: 0;
  98. vertical-align: middle;
  99. color: $black-light;
  100. > span {
  101. padding: 5px 2px;
  102. }
  103. &.nuxt-link-active, &.active, &:not(.expand-item):hover {
  104. > span {
  105. color: #5078cb;
  106. border-bottom: #5078cb 3px solid;
  107. font-weight: bold;
  108. }
  109. }
  110. &.expand-item {
  111. position: relative;
  112. .expand-list {
  113. z-index: 10;
  114. position: absolute;
  115. left: 8px;
  116. top: 40px;
  117. background: #fff;
  118. width: 106px;
  119. border-radius: 2px;
  120. display: none;
  121. -webkit-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  122. -moz-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  123. box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  124. li {
  125. height: 34px;
  126. line-height: 34px;
  127. text-align: center;
  128. span {
  129. color: #666;
  130. }
  131. &:hover {
  132. background: #5078cb;
  133. span {
  134. color: #fff;
  135. }
  136. }
  137. }
  138. }
  139. .icon-arrow-up {
  140. display: none;
  141. }
  142. &:hover {
  143. color: #2147f9;
  144. .expand-list {
  145. display: block;
  146. }
  147. .icon-arrow-up {
  148. display: inline-block;
  149. }
  150. .icon-arrow-down {
  151. display: none;
  152. }
  153. }
  154. }
  155. #kindCategory {
  156. display: none;
  157. font-weight: normal;
  158. text-align: left;
  159. z-index: 1001;
  160. top: 40px;
  161. left: 0;
  162. }
  163. &.item-first {
  164. width: 220px;
  165. margin: 0;
  166. background-color: rgb(33, 71, 151);
  167. font-size: 14px;
  168. font-weight: bold;
  169. text-align: center;
  170. color: #fff;
  171. cursor: pointer;
  172. position: relative;
  173. &:hover {
  174. #kindCategory {
  175. display: block;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. </style>