load-more.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="load-more">
  3. <view class="loading-img" v-show="loadingType === 1 && showImage">
  4. <view class="load1">
  5. <view :style="{background:color}"></view>
  6. <view :style="{background:color}"></view>
  7. <view :style="{background:color}"></view>
  8. <view :style="{background:color}"></view>
  9. </view>
  10. <view class="load2">
  11. <view :style="{background:color}"></view>
  12. <view :style="{background:color}"></view>
  13. <view :style="{background:color}"></view>
  14. <view :style="{background:color}"></view>
  15. </view>
  16. <view class="load3">
  17. <view :style="{background:color}"></view>
  18. <view :style="{background:color}"></view>
  19. <view :style="{background:color}"></view>
  20. <view :style="{background:color}"></view>
  21. </view>
  22. </view>
  23. <text class="loading-text" :style="{color:color}">{{loadingType === 0 ? contentText.contentdown : (loadingType === 1 ? contentText.contentrefresh : contentText.contentnomore)}}</text>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. name: "load-more",
  29. props: {
  30. loadingType: {
  31. //上拉的状态:0-loading前;1-loading中;2-没有更多了
  32. type: Number,
  33. default: 0
  34. },
  35. showImage: {
  36. type: Boolean,
  37. default: true
  38. },
  39. color: {
  40. type: String,
  41. default: "#777777"
  42. },
  43. contentText: {
  44. type: Object,
  45. default: {
  46. contentdown: "上拉显示更多",
  47. contentrefresh: "正在加载...",
  48. contentnomore: "没有更多数据了"
  49. }
  50. }
  51. },
  52. data() {
  53. return {}
  54. }
  55. }
  56. </script>
  57. <style>
  58. .load-more {
  59. display: flex;
  60. flex-direction: row;
  61. height: 80upx;
  62. align-items: center;
  63. justify-content: center;
  64. }
  65. .loading-img{
  66. height: 48rpx;
  67. width: 48rpx;
  68. margin-right:20rpx;
  69. }
  70. .loading-text {
  71. font-size: 30rpx;
  72. color: #777777;
  73. }
  74. .loading-img>view {
  75. position: absolute;
  76. }
  77. .load1,.load2,.load3 {
  78. height: 50rpx;
  79. width: 50rpx;
  80. }
  81. .load2 {
  82. transform: rotate(30deg);
  83. }
  84. .load3 {
  85. transform: rotate(60deg);
  86. }
  87. .loading-img>view view {
  88. width: 12rpx;
  89. height: 4rpx;
  90. border-top-left-radius: 1px;
  91. border-bottom-left-radius: 1px;
  92. background: #777;
  93. position: absolute;
  94. opacity: 0.2;
  95. transform-origin: 50%;
  96. -webkit-animation: load 1.56s ease infinite;
  97. }
  98. .loading-img>view view:nth-child(1) {
  99. transform: rotate(90deg);
  100. top:2px;
  101. left:9px;
  102. }
  103. .loading-img>view view:nth-child(2) {
  104. -webkit-transform: rotate(180deg);
  105. top:11px;
  106. right:0px;
  107. }
  108. .loading-img>view view:nth-child(3) {
  109. transform: rotate(270deg);
  110. bottom:4rpx;
  111. left:18rpx;
  112. }
  113. .loading-img>view view:nth-child(4) {
  114. top:22rpx;
  115. left:0px;
  116. }
  117. .load1 view:nth-child(1) {
  118. animation-delay: 0s;
  119. }
  120. .load2 view:nth-child(1) {
  121. animation-delay: 0.13s;
  122. }
  123. .load3 view:nth-child(1) {
  124. animation-delay: 0.26s;
  125. }
  126. .load1 view:nth-child(2) {
  127. animation-delay: 0.39s;
  128. }
  129. .load2 view:nth-child(2) {
  130. animation-delay: 0.52s;
  131. }
  132. .load3 view:nth-child(2) {
  133. animation-delay: 0.65s;
  134. }
  135. .load1 view:nth-child(3) {
  136. animation-delay: 0.78s;
  137. }
  138. .load2 view:nth-child(3) {
  139. animation-delay: 0.91s;
  140. }
  141. .load3 view:nth-child(3) {
  142. animation-delay: 1.04s;
  143. }
  144. .load1 view:nth-child(4) {
  145. animation-delay: 1.17s;
  146. }
  147. .load2 view:nth-child(4) {
  148. animation-delay: 1.30s;
  149. }
  150. .load3 view:nth-child(4) {
  151. animation-delay: 1.43s;
  152. }
  153. @-webkit-keyframes load {
  154. 0% {
  155. opacity: 1;
  156. }
  157. 100% {
  158. opacity: 0.2;
  159. }
  160. }
  161. </style>