index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="commonTabs-v">
  3. <view class="icon-ym u-tabs-box" v-if="list.length" :class="{'boxShadow':isBoxShadow}">
  4. <view class="apply-tabs">
  5. <u-tabs :list="list" v-model="tabCurrent" @change="change" :is-scroll="isScroll" :name="prop"
  6. :height="height">
  7. </u-tabs>
  8. </view>
  9. <view class="more-icon" :class="icon" @click="iconClick "></view>
  10. </view>
  11. <u-popup v-model="showPopup" mode="bottom" closeable close-icon-color="#666666">
  12. <view class="classifyTitle">
  13. 全部分类
  14. </view>
  15. <scroll-view scroll-y="true" :style="{'height':scrollHeight+'rpx'}">
  16. <view class="classify-scroll-view u-flex">
  17. <view v-for="(item,index) in list" :key="index" @click="classifyItem(index)"
  18. class="classify-item u-font-28 u-line-1">
  19. {{item.fullName}}
  20. </view>
  21. </view>
  22. </scroll-view>
  23. </u-popup>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. props: {
  29. list: {
  30. type: Array,
  31. default: () => []
  32. },
  33. current: {
  34. type: Number,
  35. default: 0
  36. },
  37. scrollHeight: {
  38. type: String,
  39. default: '360'
  40. },
  41. prop: {
  42. type: String,
  43. default: 'fullName'
  44. },
  45. icon: {
  46. type: String,
  47. default: 'icon-ym icon-ym-app-more'
  48. },
  49. height: {
  50. type: String,
  51. default: '84'
  52. },
  53. type: {
  54. type: String,
  55. default: 'flow'
  56. },
  57. isBoxShadow: {
  58. type: Boolean,
  59. default: false
  60. },
  61. isScroll: {
  62. type: Boolean,
  63. default: true
  64. }
  65. },
  66. data() {
  67. return {
  68. tabCurrent: 0,
  69. showPopup: false,
  70. categoryList: []
  71. }
  72. },
  73. watch: {
  74. current: {
  75. handler(val) {
  76. this.tabCurrent = val
  77. },
  78. immediate: true
  79. }
  80. },
  81. methods: {
  82. classifyItem(index) {
  83. this.change(index)
  84. },
  85. iconClick() {
  86. if (this.type != 'flow') return this.$emit('iconClick');
  87. this.showPopup = true
  88. },
  89. change(e) {
  90. this.tabCurrent = e;
  91. this.showPopup = false;
  92. this.$emit('change', e);
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. .commonTabs-v {
  99. .boxShadow {
  100. box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
  101. }
  102. .u-tabs-box {
  103. position: relative;
  104. .apply-tabs {
  105. width: 94%;
  106. .u-tabs {
  107. height: 2.75rem;
  108. }
  109. }
  110. .more-icon {
  111. position: absolute;
  112. top: 0;
  113. right: 0;
  114. /* #ifdef MP */
  115. height: 85rpx;
  116. line-height: 85rpx;
  117. /* #endif */
  118. /* #ifndef MP */
  119. height: 88rpx;
  120. line-height: 88rpx;
  121. /* #endif */
  122. text-align: center;
  123. padding: 0 16rpx;
  124. background-color: #fff;
  125. opacity: 0.9;
  126. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.1);
  127. }
  128. }
  129. .classifyTitle {
  130. font-family: PingFang SC;
  131. height: 110rpx;
  132. width: 100%;
  133. line-height: 110rpx;
  134. padding-left: 20rpx;
  135. padding-right: 20rpx;
  136. font-size: 32rpx;
  137. color: #333333;
  138. font-weight: 500;
  139. }
  140. .classify-scroll-view {
  141. padding-bottom: 70rpx;
  142. padding: 0 20rpx 64rpx;
  143. justify-content: flex-start;
  144. flex-wrap: wrap;
  145. .classify-item {
  146. width: 22%;
  147. text-align: center;
  148. margin: 10rpx;
  149. background-color: #EEF0F4;
  150. border-radius: 8rpx;
  151. background: rgba(238, 240, 244, 0.39);
  152. color: #666666;
  153. line-height: 58rpx;
  154. padding: 0 20rpx;
  155. }
  156. }
  157. }
  158. </style>