login.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="skeleton-box">
  3. <view v-if="loading" class="skeleton">
  4. <div class="spinner">
  5. <div class="spinner-container container1">
  6. <div class="circle1"></div>
  7. <div class="circle2"></div>
  8. <div class="circle3"></div>
  9. <div class="circle4"></div>
  10. </div>
  11. <div class="spinner-container container2">
  12. <div class="circle1"></div>
  13. <div class="circle2"></div>
  14. <div class="circle3"></div>
  15. <div class="circle4"></div>
  16. </div>
  17. <div class="spinner-container container3">
  18. <div class="circle1"></div>
  19. <div class="circle2"></div>
  20. <div class="circle3"></div>
  21. <div class="circle4"></div>
  22. </div>
  23. </div>
  24. </view>
  25. <van-transition v-else name="fade-up">
  26. <slot></slot>
  27. </van-transition>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. props: {
  33. loading: {
  34. type: Boolean,
  35. default: true
  36. },
  37. list: {
  38. type: Array,
  39. default: [1]
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .skeleton {
  46. display: flex;
  47. justify-content: center;
  48. align-items: center;
  49. padding: 50rpx;
  50. height: 320rpx;
  51. }
  52. .led {
  53. width: 10rpx;
  54. height: 30rpx;
  55. border-radius: 10rpx;
  56. top: 50rpx;
  57. position: absolute;
  58. transform: rotate(calc(360deg / var(--all) * var(--i)));
  59. transform-origin: 0 160rpx;
  60. animation: loading 2s linear infinite;
  61. animation-delay: calc(var(--i) * 1s);
  62. background-color: green;
  63. }
  64. @keyframes loading {
  65. from {
  66. opacity: 0;
  67. }
  68. to {
  69. opacity: 1;
  70. }
  71. }
  72. .spinner {
  73. margin: 100px auto;
  74. width: 20px;
  75. height: 20px;
  76. position: relative;
  77. }
  78. .container1 > div, .container2 > div, .container3 > div {
  79. width: 6px;
  80. height: 6px;
  81. background-color: #333;
  82. border-radius: 100%;
  83. position: absolute;
  84. -webkit-animation: bouncedelay 1.2s infinite ease-in-out;
  85. animation: bouncedelay 1.2s infinite ease-in-out;
  86. -webkit-animation-fill-mode: both;
  87. animation-fill-mode: both;
  88. }
  89. .spinner .spinner-container {
  90. position: absolute;
  91. width: 100%;
  92. height: 100%;
  93. }
  94. .container2 {
  95. -webkit-transform: rotateZ(45deg);
  96. transform: rotateZ(45deg);
  97. }
  98. .container3 {
  99. -webkit-transform: rotateZ(90deg);
  100. transform: rotateZ(90deg);
  101. }
  102. .circle1 { top: 0; left: 0; }
  103. .circle2 { top: 0; right: 0; }
  104. .circle3 { right: 0; bottom: 0; }
  105. .circle4 { left: 0; bottom: 0; }
  106. .container2 .circle1 {
  107. -webkit-animation-delay: -1.1s;
  108. animation-delay: -1.1s;
  109. }
  110. .container3 .circle1 {
  111. -webkit-animation-delay: -1.0s;
  112. animation-delay: -1.0s;
  113. }
  114. .container1 .circle2 {
  115. -webkit-animation-delay: -0.9s;
  116. animation-delay: -0.9s;
  117. }
  118. .container2 .circle2 {
  119. -webkit-animation-delay: -0.8s;
  120. animation-delay: -0.8s;
  121. }
  122. .container3 .circle2 {
  123. -webkit-animation-delay: -0.7s;
  124. animation-delay: -0.7s;
  125. }
  126. .container1 .circle3 {
  127. -webkit-animation-delay: -0.6s;
  128. animation-delay: -0.6s;
  129. }
  130. .container2 .circle3 {
  131. -webkit-animation-delay: -0.5s;
  132. animation-delay: -0.5s;
  133. }
  134. .container3 .circle3 {
  135. -webkit-animation-delay: -0.4s;
  136. animation-delay: -0.4s;
  137. }
  138. .container1 .circle4 {
  139. -webkit-animation-delay: -0.3s;
  140. animation-delay: -0.3s;
  141. }
  142. .container2 .circle4 {
  143. -webkit-animation-delay: -0.2s;
  144. animation-delay: -0.2s;
  145. }
  146. .container3 .circle4 {
  147. -webkit-animation-delay: -0.1s;
  148. animation-delay: -0.1s;
  149. }
  150. @-webkit-keyframes bouncedelay {
  151. 0%, 80%, 100% { -webkit-transform: scale(0.0) }
  152. 40% { -webkit-transform: scale(1.0) }
  153. }
  154. @keyframes bouncedelay {
  155. 0%, 80%, 100% {
  156. transform: scale(0.0);
  157. -webkit-transform: scale(0.0);
  158. } 40% {
  159. transform: scale(1.0);
  160. -webkit-transform: scale(1.0);
  161. }
  162. }
  163. </style>