Loading.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="loading">
  3. <div></div>
  4. <div></div>
  5. </div>
  6. </template>
  7. <script>
  8. export default {
  9. name: "Loading"
  10. }
  11. </script>
  12. <style scoped>
  13. /*纯css实现loading效果*/
  14. .loading,
  15. .loading > div {
  16. position: relative;
  17. box-sizing: border-box;
  18. }
  19. .loading {
  20. display: block;
  21. font-size: 0;
  22. color: #000;
  23. }
  24. .loading.la-dark {
  25. color: #333;
  26. }
  27. .loading > div {
  28. display: inline-block;
  29. float: none;
  30. background-color: currentColor;
  31. border: 0 solid currentColor;
  32. }
  33. .loading {
  34. width: 100%;
  35. height: 100%;
  36. animation: ball-spin-rotate 2s infinite linear;
  37. }
  38. .loading > div {
  39. position: absolute;
  40. top: 0;
  41. width: 60%;
  42. height: 60%;
  43. border-radius: 100%;
  44. animation: ball-spin-bounce 2s infinite ease-in-out;
  45. }
  46. .loading > div:last-child {
  47. top: auto;
  48. bottom: 0;
  49. animation-delay: -1s;
  50. }
  51. @keyframes ball-spin-rotate {
  52. 100% {
  53. transform: rotate(360deg);
  54. }
  55. }
  56. @keyframes ball-spin-bounce {
  57. 0%,
  58. 100% {
  59. transform: scale(0);
  60. }
  61. 50% {
  62. transform: scale(1);
  63. }
  64. }
  65. </style>