zero.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  5. </view>
  6. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab" :style="{ height: maxheight + 'px' }">
  7. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  8. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  9. <!-- 空白页 -->
  10. <empty v-if="tabItem.orderList.length === 0"></empty>
  11. <!-- 订单列表 -->
  12. <view v-for="(ls, index) in tabItem.orderList"></view>
  13. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  14. </scroll-view>
  15. </swiper-item>
  16. </swiper>
  17. </view>
  18. </template>
  19. <script>
  20. import empty from '@/components/empty';
  21. export default {
  22. components: {
  23. empty,
  24. },
  25. // 计算剩余高度
  26. onReady(res) {
  27. var _this = this;
  28. uni.getSystemInfo({
  29. success: resu => {
  30. const query = uni.createSelectorQuery();
  31. query.select('.swiper-box').boundingClientRect();
  32. query.exec(function(res) {
  33. console.log(res, 'ddddddddddddd');
  34. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  35. console.log('打印页面的剩余高度', _this.maxheight);
  36. });
  37. },
  38. fail: res => {}
  39. });
  40. },
  41. data() {
  42. return {
  43. // 头部图高度
  44. maxheight: '',
  45. tabCurrentIndex: 0,
  46. navList: [
  47. {
  48. text: '首页',
  49. loadingType: 'more',
  50. orderList: [],
  51. page: 1, //当前页数
  52. limit: 10 //每次信息条数
  53. },
  54. {
  55. text: '我的抢购',
  56. loadingType: 'more',
  57. orderList: [],
  58. page: 1, //当前页数
  59. limit: 10 //每次信息条数
  60. }
  61. ]
  62. };
  63. },
  64. methods: {
  65. tabClick(index) {
  66. this.tabCurrentIndex = index;
  67. }
  68. }
  69. };
  70. </script>
  71. <style lang="less">
  72. .content,page {
  73. }
  74. .navbar {
  75. display: flex;
  76. height: 40px;
  77. padding: 0 5px;
  78. background: #fff;
  79. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  80. position: relative;
  81. z-index: 10;
  82. .nav-item {
  83. flex: 1;
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. height: 100%;
  88. font-size: 15px;
  89. color: #999999;
  90. position: relative;
  91. &.current {
  92. color: #dc262b;
  93. &:after {
  94. content: '';
  95. position: absolute;
  96. left: 50%;
  97. bottom: 0;
  98. transform: translateX(-50%);
  99. width: 44px;
  100. height: 0;
  101. border-bottom: 2px solid #dc262b;
  102. }
  103. }
  104. }
  105. }
  106. .swiper-box {
  107. .order-item {
  108. padding: 20rpx 30rpx;
  109. line-height: 1.5;
  110. }
  111. }
  112. </style>