login.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="skeleton-box">
  3. <view v-if="loading" class="skeleton">
  4. <div class="spinner">
  5. <div></div>
  6. <div></div>
  7. <div></div>
  8. <div></div>
  9. <div></div>
  10. </div>
  11. </view>
  12. <van-transition v-else name="fade-up">
  13. <slot></slot>
  14. </van-transition>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. props: {
  20. loading: {
  21. type: Boolean,
  22. default: true
  23. },
  24. list: {
  25. type: Array,
  26. default: [1]
  27. }
  28. }
  29. }
  30. </script>
  31. <style lang="scss" scoped>
  32. .skeleton {
  33. display: flex;
  34. justify-content: center;
  35. align-items: center;
  36. padding: 50rpx;
  37. height: 320rpx;
  38. }
  39. .led {
  40. width: 10rpx;
  41. height: 30rpx;
  42. border-radius: 10rpx;
  43. top: 50rpx;
  44. position: absolute;
  45. transform: rotate(calc(360deg / var(--all) * var(--i)));
  46. transform-origin: 0 160rpx;
  47. animation: loading 2s linear infinite;
  48. animation-delay: calc(var(--i) * 1s);
  49. background-color: green;
  50. }
  51. @keyframes loading {
  52. from {
  53. opacity: 0;
  54. }
  55. to {
  56. opacity: 1;
  57. }
  58. }
  59. .spinner {
  60. margin: 100px auto;
  61. width: 50px;
  62. height: 50px;
  63. text-align: center;
  64. font-size: 10px;
  65. }
  66. .spinner>div {
  67. display: inline-block;
  68. background-color: rgb(55, 226, 83);
  69. height: 100%;
  70. width: 5px;
  71. margin-right: 1px;
  72. animation: bytedance 1s infinite;
  73. }
  74. .spinner>div:nth-of-type(2) {
  75. background-color: rgb(41, 124, 54);
  76. animation-delay: -0.9s;
  77. }
  78. .spinner>div:nth-child(3) {
  79. background-color: rgb(45, 173, 22);
  80. animation-delay: -0.8s;
  81. }
  82. .spinner>div:nth-child(4) {
  83. background-color: rgb(154, 173, 153);
  84. animation-delay: -0.7s;
  85. }
  86. .spinner>div:nth-child(5) {
  87. background-color: rgb(22, 240, 77);
  88. animation-delay: -0.6s;
  89. }
  90. @keyframes bytedance {
  91. 0%,
  92. 40%,
  93. 100% {
  94. transform: scaleY(0.4);
  95. }
  96. 20% {
  97. transform: scaleY(1);
  98. }
  99. }
  100. </style>