loading-state.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!-- 空页面
  2. 空图标可以自定义
  3. 内容提示可以自定义
  4. 空页面所占的高度也可以自自定义
  5. -->
  6. <template name="loadingState">
  7. <view class="allow_loading_more flex_row_center_center" v-if="state == 'allow_loading_more'">
  8. <text class="allow_loading_icon iconfont iconshanghua"></text>
  9. <text class="tip">向上滑动浏览更多数据</text>
  10. </view>
  11. <view class="common_loading flex_row_center_center" v-else-if="state == 'first_loading'" :style="{marginTop:mTop}">
  12. <image class="loading_icon" :src="imgUrl+'loading_more.gif'" />
  13. </view>
  14. <view class="allow_loading_more flex_row_center_center" v-else-if="state == 'loading'">
  15. <image class="loading_more_icon" :src="imgUrl+'loading_more.gif'" />
  16. <text class="tip">数据加载中...</text>
  17. </view>
  18. <!-- showEndFlag 默认为true,展示,设置为false,则不展示 -->
  19. <view class="no_more_data" v-else-if="state == 'no_more_data'&&showEndFlag">
  20. 数据加载完毕~
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. name: "loadingState",
  26. data() {
  27. return {
  28. imgUrl: getApp().globalData.imgUrl
  29. }
  30. },
  31. props: {
  32. state: {
  33. type: String,
  34. default: 'allow_loading_more',
  35. },
  36. mTop: {
  37. type: String,
  38. default: '200rpx',
  39. },
  40. showEndFlag: {
  41. type: Boolean,
  42. default: true,
  43. }
  44. },
  45. methods: {
  46. }
  47. }
  48. </script>
  49. <style lang='scss'>
  50. /* template:allow_loading_more start */
  51. .allow_loading_more {
  52. height: 80rpx;
  53. .allow_loading_icon {
  54. width: 30rpx;
  55. height: 30rpx;
  56. margin-right: 12rpx;
  57. color: $main-color;
  58. }
  59. .tip {
  60. color: #bbb;
  61. font-size: 24rpx;
  62. }
  63. .loading_more_icon {
  64. width: 46rpx;
  65. height: 46rpx;
  66. }
  67. }
  68. /* template:allow_loading_more end */
  69. /* template:loading start */
  70. .common_loading {
  71. flex: 1;
  72. .loading_icon {
  73. width: 110rpx;
  74. height: 110rpx;
  75. }
  76. }
  77. /* template:loading end */
  78. /* template:no_more_data start */
  79. .no_more_data {
  80. display: flex;
  81. align-items: center;
  82. justify-content: center;
  83. position: relative;
  84. height: 80rpx;
  85. text-align: center;
  86. line-height: 80rpx;
  87. color: #bbb;
  88. font-size: 24rpx;
  89. width: 750rpx;
  90. }
  91. /* template:no_more_data end */
  92. </style>