Nav.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 expand-item" :class="{'active': isActive}">
  18. <span>{{name}}
  19. <i class="iconfont icon-arrow-down"></i>
  20. <i class="iconfont icon-arrow-up"></i>
  21. </span>
  22. <ul class="expand-list">
  23. <li v-show="name !== '原厂专区'">
  24. <nuxt-link to="/provider/factories">原厂专区</nuxt-link>
  25. </li>
  26. <li v-show="name !== '代理经销'">
  27. <nuxt-link to="/provider/home">代理经销</nuxt-link>
  28. </li>
  29. <li>
  30. <nuxt-link target="_blank" :to="{ name: 'store-uuid', params: { uuid: '33069557578d44e69bd91ad12d28a8d4' } }">库存寄售</nuxt-link>
  31. </li>
  32. </ul>
  33. </a>
  34. <nuxt-link to="/product/brand/brandList/ABC" class="item">
  35. <span>品牌墙</span>
  36. </nuxt-link>
  37. <nuxt-link to="/news" class="item">
  38. <span>优软快讯</span>
  39. </nuxt-link>
  40. </div>
  41. </nav>
  42. </template>
  43. <script>
  44. export default {
  45. name: 'navView',
  46. computed: {
  47. name () {
  48. let path = this.$route.path
  49. if (path === '/provider/factories') {
  50. return '原厂专区'
  51. } else if (path === '/provider/home') {
  52. return '代理经销'
  53. } else {
  54. return '店 铺'
  55. }
  56. },
  57. isActive () {
  58. return (this.$route.path === '/provider/factories' && this.name === '原厂专区') || (this.$route.path === '/provider/home' && this.name === '代理经销')
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. @import '~assets/scss/variables';
  65. $nav-height: 40px;
  66. .nav-list a span{
  67. font-size: 14px;
  68. }
  69. .nav-list {
  70. background-color: rgb(244, 248, 255);
  71. height: $nav-height;
  72. .item {
  73. display: inline-block;
  74. height: $nav-height;
  75. line-height: $nav-height;
  76. width: 126px;
  77. text-align: center;
  78. margin: 0;
  79. vertical-align: middle;
  80. color: $black-light;
  81. > span {
  82. padding: 5px 2px;
  83. }
  84. &.nuxt-link-active, &.active, &:not(.expand-item):hover {
  85. > span {
  86. color: #5078cb;
  87. border-bottom: #5078cb 3px solid;
  88. font-weight: bold;
  89. }
  90. }
  91. &.expand-item {
  92. position: relative;
  93. .expand-list {
  94. z-index: 10;
  95. position: absolute;
  96. left: 8px;
  97. background: #fff;
  98. width: 106px;
  99. border-radius: 2px;
  100. display: none;
  101. -webkit-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  102. -moz-box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  103. box-shadow: 0 1px 12px 0 rgba(0,0,0,.2);
  104. li {
  105. height: 34px;
  106. line-height: 34px;
  107. text-align: center;
  108. a {
  109. color: #666;
  110. }
  111. &:hover {
  112. background: #5078cb;
  113. a {
  114. color: #fff;
  115. }
  116. }
  117. }
  118. }
  119. .icon-arrow-up {
  120. display: none;
  121. }
  122. &:hover {
  123. color: #2147f9;
  124. .expand-list {
  125. display: block;
  126. }
  127. .icon-arrow-up {
  128. display: inline-block;
  129. }
  130. .icon-arrow-down {
  131. display: none;
  132. }
  133. }
  134. }
  135. &.item-first {
  136. width: 200px;
  137. margin: 0;
  138. background-color: rgb(33, 71, 151);
  139. font-size: 14px;
  140. font-weight: bold;
  141. text-align: center;
  142. color: #fff;
  143. cursor: pointer;
  144. }
  145. }
  146. }
  147. </style>