Loading.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view class="loading-container">
  3. <view class="loader">
  4. <view class="loader-inner ball-grid-pulse">
  5. <view :style="{ 'background-color': color }"></view>
  6. <view :style="{ 'background-color': color }"></view>
  7. <view :style="{ 'background-color': color }"></view>
  8. <view :style="{ 'background-color': color }"></view>
  9. <view :style="{ 'background-color': color }"></view>
  10. <view :style="{ 'background-color': color }"></view>
  11. <view :style="{ 'background-color': color }"></view>
  12. <view :style="{ 'background-color': color }"></view>
  13. <view :style="{ 'background-color': color }"></view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. props: {
  21. color: {
  22. type: String,
  23. default: '#f87f4b'
  24. }
  25. }
  26. };
  27. </script>
  28. <style lang="less" scoped>
  29. .loading-container {
  30. position: absolute;
  31. top: 0;
  32. left: 0;
  33. width: 100%;
  34. height: 100%;
  35. background-color: #f5f5f7;
  36. display: flex;
  37. align-items: center;
  38. justify-content: center;
  39. z-index: 90000;
  40. @keyframes ball-grid-pulse {
  41. 0% {
  42. -webkit-transform: scale(1);
  43. transform: scale(1);
  44. }
  45. 50% {
  46. -webkit-transform: scale(0.5);
  47. transform: scale(0.5);
  48. opacity: 0.7;
  49. }
  50. 100% {
  51. -webkit-transform: scale(1);
  52. transform: scale(1);
  53. opacity: 1;
  54. }
  55. }
  56. .ball-grid-pulse {
  57. width: 57px;
  58. }
  59. .ball-grid-pulse > view:nth-child(1) {
  60. -webkit-animation-delay: -0.06s;
  61. animation-delay: -0.06s;
  62. -webkit-animation-duration: 0.72s;
  63. animation-duration: 0.72s;
  64. }
  65. .ball-grid-pulse > view:nth-child(2) {
  66. -webkit-animation-delay: 0.25s;
  67. animation-delay: 0.25s;
  68. -webkit-animation-duration: 1.02s;
  69. animation-duration: 1.02s;
  70. }
  71. .ball-grid-pulse > view:nth-child(3) {
  72. -webkit-animation-delay: -0.17s;
  73. animation-delay: -0.17s;
  74. -webkit-animation-duration: 1.28s;
  75. animation-duration: 1.28s;
  76. }
  77. .ball-grid-pulse > view:nth-child(4) {
  78. -webkit-animation-delay: 0.48s;
  79. animation-delay: 0.48s;
  80. -webkit-animation-duration: 1.42s;
  81. animation-duration: 1.42s;
  82. }
  83. .ball-grid-pulse > view:nth-child(5) {
  84. -webkit-animation-delay: 0.31s;
  85. animation-delay: 0.31s;
  86. -webkit-animation-duration: 1.45s;
  87. animation-duration: 1.45s;
  88. }
  89. .ball-grid-pulse > view:nth-child(6) {
  90. -webkit-animation-delay: 0.03s;
  91. animation-delay: 0.03s;
  92. -webkit-animation-duration: 1.18s;
  93. animation-duration: 1.18s;
  94. }
  95. .ball-grid-pulse > view:nth-child(7) {
  96. -webkit-animation-delay: 0.46s;
  97. animation-delay: 0.46s;
  98. -webkit-animation-duration: 0.87s;
  99. animation-duration: 0.87s;
  100. }
  101. .ball-grid-pulse > view:nth-child(8) {
  102. -webkit-animation-delay: 0.78s;
  103. animation-delay: 0.78s;
  104. -webkit-animation-duration: 1.45s;
  105. animation-duration: 1.45s;
  106. }
  107. .ball-grid-pulse > view:nth-child(9) {
  108. -webkit-animation-delay: 0.45s;
  109. animation-delay: 0.45s;
  110. -webkit-animation-duration: 1.06s;
  111. animation-duration: 1.06s;
  112. }
  113. .ball-grid-pulse > view {
  114. background-color: #f87f4b;
  115. width: 15px;
  116. height: 15px;
  117. border-radius: 100%;
  118. margin: 2px;
  119. -webkit-animation-fill-mode: both;
  120. animation-fill-mode: both;
  121. display: inline-block;
  122. float: left;
  123. animation: ball-grid-pulse 1s ease-in-out infinite;
  124. }
  125. }
  126. </style>