loadMore.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="loadMore" :class="{'maxHeight': emptyData}">
  3. <slot></slot>
  4. <view class="loadingMore" v-if="!emptyData">
  5. <view class="hoveMore" v-if="more">
  6. <view class="weui-loading"></view>
  7. <view class="loading-text">正在加载...</view>
  8. </view>
  9. <view class="noData" v-if="!more">
  10. <view>没有更多数据了</view>
  11. </view>
  12. </view>
  13. <!-- <empty wx:if="{{emptyData}}"></empty> -->
  14. <empty-data v-if="emptyData"></empty-data>
  15. </view>
  16. </template>
  17. <script>
  18. import emptyData from '@/components/emptyData'
  19. export default {
  20. props: {
  21. more: {
  22. type: Boolean,
  23. default: true,
  24. twoWay: true
  25. },
  26. emptyData: {
  27. type: Boolean,
  28. default: false,
  29. twoWay: true
  30. }
  31. },
  32. components: {
  33. emptyData
  34. },
  35. data() {
  36. return {
  37. };
  38. }
  39. }
  40. </script>
  41. <style lang="scss">
  42. .loadMore{
  43. position: relative;
  44. &.maxHeight{
  45. height: 65vh;
  46. }
  47. }
  48. .loadingMore{
  49. height: 130rpx;
  50. // background-color: #f7f7f7;
  51. .hoveMore{
  52. display: flex;
  53. justify-content: center;
  54. align-items: center;
  55. height: 100rpx;
  56. .loading-text{
  57. font-size: 28rpx;
  58. color: #666666;
  59. }
  60. }
  61. .noData{
  62. display: flex;
  63. justify-content: center;
  64. font-size: 28rpx;
  65. color: #666666;
  66. height: 100rpx;
  67. width: 200rpx;
  68. align-items: center;
  69. position: relative;
  70. z-index: 2;
  71. margin: 0 auto;
  72. &:before{
  73. content:'';
  74. left: -80rpx;
  75. height: 1px;
  76. top: 50rpx;
  77. width: 60rpx;
  78. background-color: #999;
  79. position: absolute;
  80. }
  81. &:after{
  82. content:'';
  83. right: -80rpx;
  84. height: 1px;
  85. top: 50rpx;
  86. width: 60rpx;
  87. background-color: #999;
  88. position: absolute;
  89. }
  90. }
  91. }
  92. </style>