list1.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view class="container">
  3. <view class="tabs flex">
  4. <scroll-view scroll-x class="bg-white nav" style="width: 90%;">
  5. <view class="flex text-center">
  6. <view class="cu-item flex-sub" :class="index==current?'text-blue text-xl text-bold ':'text-lg'" v-for="(item,index) in tabs" :key="index" @tap="tabChange(index)" >
  7. {{item.name}}
  8. </view>
  9. </view>
  10. </scroll-view>
  11. <view class="" @click="tapFilterShow">
  12. <text class="cuIcon-filter" style="font-size: 40rpx;"></text>
  13. </view>
  14. </view>
  15. <view style="height: 100%;">
  16. <swiper style="height: 100%;" :current="current" @change="swiperChange"
  17. @animationfinish="animationfinish">
  18. <swiper-item v-for="(item, index) in tabs" :key="index">
  19. <scroll-view scroll-y style="height: 100%;">
  20. <item ref="mescrollItem" :refresh="refresh" :i="index" :item="item" :type="current"></item>
  21. </scroll-view>
  22. </swiper-item>
  23. </swiper>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import item from "./item.vue"
  29. export default {
  30. components: {
  31. item
  32. },
  33. data() {
  34. return {
  35. //让item主动刷新
  36. refresh:false,
  37. scrollLeft:0,
  38. current: 0,
  39. swiperCurrent:0,
  40. tabs: [
  41. {
  42. name: '全部',
  43. value:-1
  44. },
  45. {
  46. name: '待审核',
  47. value:0
  48. },
  49. {
  50. name: '已通过',
  51. value:1
  52. },
  53. {
  54. name:'未通过',
  55. value:2
  56. }
  57. ],
  58. }
  59. },
  60. onShow(){
  61. if(this.canReset){
  62. let curMescroll = this.getMescroll(this.current)
  63. // curMescroll.scrosllTo(0, 100);
  64. curMescroll && curMescroll.resetUpScroll()
  65. }
  66. this.canReset = true
  67. },
  68. methods:{
  69. tapFilterShow(){
  70. let mescrollItems = this.$refs.mescrollItem;
  71. if(mescrollItems){
  72. let item = mescrollItems[this.current]
  73. item.show()
  74. }
  75. },
  76. tabChange(index) {
  77. this.current = index
  78. },
  79. swiperChange(e) {
  80. uni.pageScrollTo({
  81. scrollTop: 0,
  82. duration: 0
  83. });
  84. this.current = e.detail.current
  85. },
  86. animationfinish({detail: { current }}) {
  87. this.swiperCurrent = current;
  88. this.current = current;
  89. },
  90. getMescroll(i){
  91. let mescrollItems = this.$refs.mescrollItem;
  92. if(mescrollItems){
  93. let item = mescrollItems[i]
  94. if(item) return item.mescroll
  95. }
  96. return null
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .text-blue{
  103. color: #59a5f0;
  104. }
  105. .text-xl{
  106. font-size: 34rpx;
  107. }
  108. .container {
  109. height: calc(100vh);
  110. background-color: #F6F6F6;
  111. padding: 78rpx 0rpx 0rpx;
  112. .tabs {
  113. position: fixed;
  114. top: -10rpx;
  115. left: 0;
  116. display: flex;
  117. align-items: center;
  118. width: 100%;
  119. background-color: #FFFFFF;
  120. box-sizing: border-box;
  121. z-index: 3;
  122. }
  123. }
  124. </style>