You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

loading.vue 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view>
  3. <view class="loading">
  4. <view class="dot white"></view>
  5. <view class="dot" :class="bg1"></view>
  6. <view class="dot" :class="bg2"></view>
  7. <view class="dot" :class="bg3"></view>
  8. <view class="dot" :class="bg4"></view>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name:"loading",
  15. props:{
  16. bg1:{
  17. type:String,
  18. default:'bg-red',
  19. },
  20. bg2:{
  21. type:String,
  22. default:'bg-yellow',
  23. },
  24. bg3:{
  25. type:String,
  26. default:'bg-olive',
  27. },
  28. bg4:{
  29. type:String,
  30. default:'bg-cyan',
  31. }
  32. },
  33. data() {
  34. return {
  35. };
  36. }
  37. }
  38. </script>
  39. <style>
  40. .loading {
  41. position: fixed;
  42. margin: auto;
  43. top: 0; bottom: 0; left: 0; right: 0;
  44. width: 6.250em; height: 6.250em;
  45. animation: rotate 2.4s linear infinite;
  46. z-index: 999;
  47. }
  48. .white {
  49. top: 0; bottom: 0; left: 0; right: 0;
  50. background: white;
  51. animation: flash 2.4s linear infinite;
  52. opacity: 0;
  53. }
  54. .dot {
  55. position: absolute;
  56. margin: auto;
  57. width: 2.4em; height: 2.4em;
  58. border-radius: 100%;
  59. transition: all 1s ease;
  60. }
  61. .dot:nth-child(2) { top: 0; bottom: 0; left: 0; animation: dotsY 2.4s linear infinite; }
  62. .dot:nth-child(3) { left: 0; right: 0; top: 0; animation: dotsX 2.4s linear infinite; }
  63. .dot:nth-child(4) { top: 0; bottom: 0; right: 0; animation: dotsY 2.4s linear infinite; }
  64. .dot:nth-child(5) { left: 0; right: 0; bottom: 0; animation: dotsX 2.4s linear infinite; }
  65. @keyframes rotate {
  66. 0% { transform: rotate( 0 ); }
  67. 10% { width: 6.250em; height: 6.250em; }
  68. 66% { width: 2.4em; height: 2.4em; }
  69. 100%{ transform: rotate(360deg); width: 6.250em; height: 6.250em; }
  70. }
  71. @keyframes dotsY {
  72. 66% { opacity: .1; width: 2.4em; }
  73. 77%{ opacity: 1; width: 0; }
  74. }
  75. @keyframes dotsX {
  76. 66% { opacity: .1; height: 2.4em;}
  77. 77%{ opacity: 1; height: 0; }
  78. }
  79. @keyframes flash {
  80. 33% { opacity: 0; border-radius: 0%; }
  81. 55%{ opacity: .6; border-radius: 100%; }
  82. 66%{ opacity: 0; }
  83. }
  84. </style>