时空网前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.6 KiB

  1. <template>
  2. <view>
  3. <view class="bg-white lf-p-t-40 lf-p-b-40 flex justify-around align-center text-center solid-bottom">
  4. <view class="tab-item"
  5. :class="current==index?'text-orange':'text-black1'"
  6. v-for="(item, index) in tab_list" :key="index"
  7. @click="current = index">{{ item.name }}
  8. </view>
  9. </view>
  10. <scroll-view :style="{height: 'calc('+ windowHeight +'px - 120rpx)'}"
  11. :scroll-y="true" :refresher-enabled="true"
  12. :refresher-triggered="isRefresher"
  13. @scrolltolower="onScrolltolower"
  14. @refresherrefresh="onRefresherrefresh"
  15. v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex"
  16. v-if="tabIndex == current">
  17. <view class="flex lf-p-30 solid-bottom" v-for="(item, index) in tabItem.list" :key="index">
  18. <view>
  19. <image src="../../static/center/shop-logo.png" style="height: 120rpx;width: 120rpx;" mode="aspectFill"></image>
  20. </view>
  21. <view class="flex flex-direction justify-around lf-p-l-20">
  22. <view class="lf-font-32 text-black1">时空网的内部网友 <text class="bg-red lf-font-24 lf-m-l-10" style="border-radius: 30rpx;padding: 5rpx 16rpx;">达人</text></view>
  23. <view class="lf-font-24 lf-color-gray">2021-7-6 21:32:53</view>
  24. </view>
  25. <!-- 空数据的情况 -->
  26. <view class="loading-more">
  27. <text v-if="tabItem.list.length" :class="{'loading-more-text': tabItem.loadingClass}">{{ tabItem.loadingText }}</text>
  28. <my-nocontent v-else></my-nocontent>
  29. </view>
  30. </view>
  31. </scroll-view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. current: 0, // tab下标
  39. pageSize: 10,
  40. isRefresher: false, // scroll-view下拉刷新状态,当前默认没有触发
  41. windowHeight: 0,
  42. tab_list: [{
  43. name: '内部粉丝',
  44. list: [1],
  45. page: 1,
  46. isPage: false,
  47. loadingClass: false,
  48. loadingText: '已加载全部数据'
  49. },{
  50. name: '外部粉丝',
  51. list: [1,2,3,4,5,6,7,8,9],
  52. page: 1,
  53. isPage: false,
  54. loadingClass: true,
  55. loadingText: '正在加载中'
  56. }]
  57. }
  58. },
  59. onLoad(){
  60. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  61. },
  62. methods: {
  63. // 页面触底,加载下一页
  64. onScrolltolower(){
  65. console.log('加载下一页')
  66. },
  67. // scroll-view 下拉刷新
  68. onRefresherrefresh(){
  69. this.isRefresher = true;
  70. console.log('下拉刷新')
  71. setTimeout(() => {
  72. this.isRefresher = false;
  73. },1000)
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .tab-item{
  80. width: 50%;
  81. box-sizing: border-box;
  82. font-size: 32rpx;
  83. &:first-child{
  84. border-right: 2rpx solid rgba(0, 0, 0, 0.1);
  85. }
  86. }
  87. </style>