supplier-loginMenu.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view>
  3. <view class="login_menu">
  4. <image class="logo" src="https://static.caimei365.com/app/img/supplier-login/logo_.png" mode="" @click="trampLink"></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>全部目录</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. trampLink() {
  93. uni.navigateTo({
  94. url: '/pages/supplier/index/index'
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style scoped lang="scss">
  101. .login_menu {
  102. width: 100%;
  103. height: 100rpx;
  104. background-color: #fff;
  105. box-shadow: 0rpx 5rpx 14rpx 0rpx rgba(51, 51, 51, 0.12);
  106. box-sizing: border-box;
  107. padding: 26rpx 40rpx;
  108. display: flex;
  109. justify-content: space-between;
  110. align-items: center;
  111. position: fixed;
  112. left: 0;
  113. top: 0;
  114. z-index: 999;
  115. }
  116. .logo {
  117. width: 132rpx;
  118. height: 48rpx;
  119. }
  120. .scroll-view {
  121. white-space: nowrap;
  122. width: 100%;
  123. }
  124. .menu_slide {
  125. width: 530rpx;
  126. box-sizing: border-box;
  127. padding: 0 106rpx 0 40rpx;
  128. .scroll_menu {
  129. width: 150rpx;
  130. font-size: 28rpx;
  131. color: #333;
  132. display: inline-block;
  133. text-align: center;
  134. box-sizing: border-box;
  135. padding-left: 20rpx;
  136. }
  137. }
  138. .check_menu {
  139. position: absolute;
  140. top: 0;
  141. right: 0;
  142. width: 148rpx;
  143. height: 100rpx;
  144. display: flex;
  145. justify-content: center;
  146. align-items: center;
  147. box-sizing: border-box;
  148. box-shadow: -10px 0px 10px 0 #fff;
  149. }
  150. .menuList {
  151. width: 100%;
  152. height: 100%;
  153. background-color: #fff;
  154. display: grid;
  155. grid-template-columns: repeat(4, 1fr);
  156. grid-template-rows: repeat(2, 1fr);
  157. align-items: center;
  158. padding: 20rpx 0;
  159. box-sizing: border-box;
  160. }
  161. .menu-btn {
  162. width: 148rpx;
  163. height: 64rpx;
  164. background: #f5f5f5;
  165. border-radius: 32rpx;
  166. font-size: 24rpx;
  167. text-align: center;
  168. color: #666666;
  169. line-height: 64rpx;
  170. }
  171. .isActive {
  172. border: 1px solid #ff5b00;
  173. color: #ff5b00;
  174. background: #fff;
  175. }
  176. .iconfont {
  177. transition: 0.2s;
  178. }
  179. .icon-xiayibu {
  180. transform: rotate(90deg);
  181. }
  182. .act-btn {
  183. transform: rotate(270deg) !important;
  184. }
  185. </style>