loading-footer.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view class="loading-footer flex row-center" :style="'color: ' + color">
  3. <view v-if="status === 'loading' " class="loading flex">
  4. <u-loading :color="color" :size="40" mode="flower"></u-loading>
  5. <text class="m-l-20" :style="'color: ' + color">{{loadingText}}</text>
  6. </view>
  7. <view v-if="status === 'finished'" class="finished">{{ finishedText }}</view>
  8. <view v-if="status === 'error'" @click="onRefresh">{{ errorText }}</view>
  9. <view v-if="status === 'empty'" class="empty">
  10. <text v-if="!slotEmpty">暂无数据</text>
  11. <slot name="empty" v-else></slot>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {};
  19. },
  20. components: {
  21. },
  22. props: {
  23. status: {
  24. type: String,
  25. default: 'loading'
  26. },
  27. errorText: {
  28. type: String,
  29. default: '加载失败,点击重新加载'
  30. },
  31. loadingText: {
  32. type: String,
  33. default: '加载中...'
  34. },
  35. finishedText: {
  36. type: String,
  37. default: '我可是有底线的~'
  38. },
  39. slotEmpty: {
  40. type: Boolean,
  41. default: false
  42. },
  43. color: {
  44. type: String,
  45. default: "#666"
  46. }
  47. },
  48. methods: {
  49. onRefresh() {
  50. this.$emit('refresh');
  51. }
  52. }
  53. };
  54. </script>
  55. <style>
  56. .loading-footer {
  57. padding: 30rpx 0;
  58. color: #666;
  59. }
  60. </style>