loading.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="loading" v-show="show">
  3. <div class="spinner2">
  4. <div class="rect1 rect"></div>
  5. <div class="rect2 rect"></div>
  6. <div class="rect3 rect"></div>
  7. <div class="rect4 rect"></div>
  8. <div class="rect5 rect"></div>
  9. <div class="rect6 rect"></div>
  10. <div class="rect7 rect"></div>
  11. <div class="percent" v-if="percent">{{percent}}</div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. show: false,
  20. percent: ''
  21. }
  22. },
  23. watch: {
  24. show(value) {
  25. this.show = value;
  26. },
  27. percent(val) {
  28. this.percent = val;
  29. }
  30. },
  31. }
  32. </script>
  33. <style lang="scss">
  34. .loading {
  35. position: fixed;
  36. top: 0;
  37. left: 0;
  38. right: 0;
  39. bottom: 0;
  40. background: rgba(0, 0, 0, 0.6);
  41. z-index: 9999999999;
  42. .spinner2 {
  43. position: absolute;
  44. top: 50%;
  45. left: 50%;
  46. transform: translate(-50%, -50%);
  47. width: 200px;
  48. height: 60px;
  49. text-align: center;
  50. font-size: 10px;
  51. display: flex;
  52. align-items: center;
  53. justify-content: center;
  54. .percent {
  55. font-size: 26px;
  56. color: $--color-primary;
  57. margin-left: 10px;
  58. width: 66px;
  59. text-align: right
  60. }
  61. }
  62. .spinner2 .rect {
  63. background-color: $--color-primary;
  64. height: 100%;
  65. width: 6px;
  66. -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
  67. animation: sk-stretchdelay 1.2s infinite ease-in-out;
  68. margin: 0 1px;
  69. }
  70. .spinner2 .rect2 {
  71. -webkit-animation-delay: -1.1s;
  72. animation-delay: -1.1s;
  73. }
  74. .spinner2 .rect3 {
  75. -webkit-animation-delay: -1.0s;
  76. animation-delay: -1.0s;
  77. }
  78. .spinner2 .rect4 {
  79. -webkit-animation-delay: -0.9s;
  80. animation-delay: -0.9s;
  81. }
  82. .spinner2 .rect5 {
  83. -webkit-animation-delay: -0.8s;
  84. animation-delay: -0.8s;
  85. }
  86. .spinner2 .rect6 {
  87. -webkit-animation-delay: -0.7s;
  88. animation-delay: -0.7s;
  89. }
  90. .spinner2 .rect7 {
  91. -webkit-animation-delay: -0.6s;
  92. animation-delay: -0.6s;
  93. }
  94. @-webkit-keyframes sk-stretchdelay {
  95. 0%,
  96. 40%,
  97. 100% {
  98. -webkit-transform: scaleY(0.4)
  99. }
  100. 20% {
  101. -webkit-transform: scaleY(1.0)
  102. }
  103. }
  104. @keyframes sk-stretchdelay {
  105. 0%,
  106. 40%,
  107. 100% {
  108. transform: scaleY(0.4);
  109. -webkit-transform: scaleY(0.4);
  110. }
  111. 20% {
  112. transform: scaleY(1.0);
  113. -webkit-transform: scaleY(1.0);
  114. }
  115. }
  116. }
  117. </style>