activity.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="container">
  3. <view class="tabs flex flex-direction">
  4. <scroll-view scroll-x class="bg-white nav">
  5. <view class="flex text-center">
  6. <view class="cu-item flex-sub" :class="index==current?'text-base cur text-xl text-bold ':'text-lg'"
  7. v-for="(item,index) in tabs" :key="index" @tap="tabChange(index)">
  8. {{item.name}}
  9. </view>
  10. </view>
  11. </scroll-view>
  12. </view>
  13. <view style="height: 100%;">
  14. <swiper style="height: 100%;" :current="current" @change="swiperChange" @animationfinish="animationfinish">
  15. <swiper-item v-for="(item, index) in tabs" :key="index">
  16. <scroll-view scroll-y style="height: 100%;">
  17. <item @showOpinion="showOpinion" ref="mescrollItem"
  18. :refresh="refresh"
  19. :i="index" :item="item"
  20. :type="current"></item>
  21. </scroll-view>
  22. </swiper-item>
  23. </swiper>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import item from "./comps/item.vue"
  29. export default {
  30. components: {
  31. item
  32. },
  33. data() {
  34. return {
  35. current: 0,
  36. swiperCurrent: 0,
  37. tabs: [
  38. {
  39. name: '发起',
  40. value: 0
  41. },
  42. {
  43. name: '可参加',
  44. value: 1
  45. },
  46. {
  47. name: '已参加',
  48. value: 2
  49. }
  50. ],
  51. refresh:false
  52. }
  53. },
  54. onShow() {
  55. let page= this.$util.getPageCtx()
  56. if (page.data.reload) {
  57. this.refresh=!this.refresh
  58. }
  59. },
  60. methods: {
  61. tabChange(index) {
  62. this.current = index
  63. },
  64. swiperChange(e) {
  65. uni.pageScrollTo({
  66. scrollTop: 0,
  67. duration: 0
  68. });
  69. this.current = e.detail.current
  70. },
  71. animationfinish({
  72. detail: {
  73. current
  74. }
  75. }) {
  76. this.swiperCurrent = current;
  77. this.current = current;
  78. },
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .container {
  84. height: calc(100vh);
  85. background-color: #F6F6F6;
  86. padding: 78rpx 0rpx 0rpx;
  87. .tabs {
  88. position: fixed;
  89. top: -10rpx;
  90. left: 0;
  91. width: 100%;
  92. background-color: #FFFFFF;
  93. box-sizing: border-box;
  94. z-index: 3;
  95. }
  96. }
  97. </style>