supplier-loginMenu.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view>
  3. <view class="login_menu">
  4. <image class="logo" src="@/static/supplier-login/logo_.png" mode=""></image>
  5. <view class="menu_slide">
  6. <scroll-view
  7. scroll-x="true"
  8. class="scroll-view"
  9. @scroll="scroll"
  10. :scroll-into-view="activeMenu"
  11. :scroll-with-animation="true"
  12. >
  13. <view
  14. :id="'item' + item.id"
  15. class="scroll_menu"
  16. v-for="item in menuList"
  17. @click="handlerActiveLink(item)"
  18. :key="item.id"
  19. >
  20. {{ item.title }}
  21. </view>
  22. </scroll-view>
  23. </view>
  24. <view class="check_menu" @click="scrollintoview">
  25. <text class="cell-more iconfont icon-xiayibu" :class="actbtn ? 'act-btn' : ''"></text>
  26. </view>
  27. </view>
  28. <MenuTopDropdown :show="dropdownShow" @close="closeTopDrop" translatey="100" height="260" maskTop="100">
  29. <view class="menuList">
  30. <button type="default">全部目录</button>
  31. <button
  32. type="default"
  33. class="menu-btn"
  34. :class="isActive === item.id ? 'isActive' : ''"
  35. v-for="item in menuList"
  36. :key="item.id"
  37. @click="handlerNavLink(item)"
  38. >
  39. {{ item.title }}
  40. </button>
  41. </view>
  42. </MenuTopDropdown>
  43. </view>
  44. </template>
  45. <script>
  46. import MenuTopDropdown from './menuTopDropdown'
  47. export default {
  48. components: {
  49. MenuTopDropdown
  50. },
  51. props: {
  52. menuList: {
  53. type: Array,
  54. default: () => []
  55. }
  56. },
  57. data() {
  58. return {
  59. activeMenu: '', // 滚动id
  60. dropdownShow: false,
  61. isActive: 0, // 活动链接
  62. actbtn: false
  63. }
  64. },
  65. watch: {},
  66. methods: {
  67. // 滚动菜单
  68. scroll($event) {
  69. this.activeMenu = ''
  70. },
  71. scrollintoview() {
  72. // this.activeMenu = 'item4'
  73. this.dropdownShow = !this.dropdownShow
  74. this.actbtn = !this.actbtn
  75. },
  76. closeTopDrop() {
  77. this.dropdownShow = false
  78. this.actbtn = false
  79. },
  80. handlerNavLink($event) {
  81. this.isActive = $event.id
  82. this.activeMenu = 'item' + $event.id
  83. this.dropdownShow = false
  84. this.actbtn = false
  85. this.$emit('scrollPage', this.activeMenu)
  86. },
  87. handlerActiveLink($event) {
  88. this.isActive = $event.id
  89. this.activeMenu = 'item' + $event.id
  90. this.$emit('scrollPage', this.activeMenu)
  91. }
  92. }
  93. }
  94. </script>
  95. <style scoped lang="scss">
  96. .login_menu {
  97. width: 100%;
  98. height: 100rpx;
  99. background-color: #fff;
  100. box-shadow: 0rpx 5rpx 14rpx 0rpx rgba(51, 51, 51, 0.12);
  101. box-sizing: border-box;
  102. padding: 26rpx 40rpx;
  103. display: flex;
  104. justify-content: space-between;
  105. align-items: center;
  106. position: fixed;
  107. left: 0;
  108. top: 0;
  109. z-index: 999;
  110. }
  111. .logo {
  112. width: 132rpx;
  113. height: 48rpx;
  114. }
  115. .scroll-view {
  116. white-space: nowrap;
  117. width: 100%;
  118. }
  119. .menu_slide {
  120. width: 530rpx;
  121. box-sizing: border-box;
  122. padding: 0 106rpx 0 40rpx;
  123. .scroll_menu {
  124. width: 150rpx;
  125. font-size: 28rpx;
  126. color: #333;
  127. display: inline-block;
  128. text-align: center;
  129. box-sizing: border-box;
  130. padding-left: 20rpx;
  131. }
  132. }
  133. .check_menu {
  134. position: absolute;
  135. top: 0;
  136. right: 0;
  137. width: 148rpx;
  138. height: 100rpx;
  139. display: flex;
  140. justify-content: center;
  141. align-items: center;
  142. box-sizing: border-box;
  143. box-shadow: -10px 0px 10px 0 #fff;
  144. }
  145. .menuList {
  146. width: 100%;
  147. height: 100%;
  148. background-color: #fff;
  149. display: grid;
  150. grid-template-columns: repeat(4, 1fr);
  151. grid-template-rows: repeat(2, 1fr);
  152. align-items: center;
  153. }
  154. .menu-btn {
  155. width: 148rpx;
  156. height: 64rpx;
  157. background: #f5f5f5;
  158. border-radius: 32rpx;
  159. font-size: 24rpx;
  160. text-align: center;
  161. color: #666666;
  162. line-height: 64rpx;
  163. }
  164. .isActive {
  165. border: 1px solid #ff5b00;
  166. color: #ff5b00;
  167. background: #fff;
  168. }
  169. .iconfont {
  170. transition: 0.2s;
  171. }
  172. .icon-xiayibu {
  173. transform: rotate(90deg);
  174. }
  175. .act-btn {
  176. transform: rotate(270deg) !important;
  177. }
  178. </style>