loading-cover.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="loading-layer" v-show="isShow">
  3. <view class="loading-anim">
  4. <view class="box item"><view class="border out item color-base-border-top color-base-border-left"></view></view>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import nsLoading from '@/components/ns-loading/ns-loading.vue';
  10. export default {
  11. name: 'loading-cover',
  12. data() {
  13. return {
  14. isShow: true
  15. };
  16. },
  17. components: {
  18. nsLoading
  19. },
  20. methods: {
  21. show() {
  22. this.isShow = true;
  23. },
  24. hide() {
  25. this.isShow = false;
  26. }
  27. }
  28. };
  29. </script>
  30. <style lang="scss">
  31. @keyframes spin {
  32. from {
  33. transform: rotate(0deg);
  34. }
  35. to {
  36. transform: rotate(360deg);
  37. }
  38. }
  39. .loading-layer {
  40. width: 100vw;
  41. height: 100vh;
  42. position: fixed;
  43. top: 0;
  44. left: 0;
  45. z-index: 997;
  46. background: #f8f8f8;
  47. }
  48. .loading-anim {
  49. position: absolute;
  50. left: 50%;
  51. top: 40%;
  52. transform: translate(-50%, -50%);
  53. }
  54. .loading-anim > .item {
  55. position: relative;
  56. width: 35px;
  57. height: 35px;
  58. perspective: 800px;
  59. transform-style: preserve-3d;
  60. transition: all 0.2s ease-out;
  61. }
  62. .loading-anim .border {
  63. position: absolute;
  64. border-radius: 50%;
  65. border: 3px solid;
  66. }
  67. .loading-anim .out {
  68. top: 15%;
  69. left: 15%;
  70. width: 70%;
  71. height: 70%;
  72. // border-left-color: red !important;
  73. border-right-color: rgba($color: #000000, $alpha: 0) !important;
  74. // border-top-color: rgba($color: #000000, $alpha: 0) !important;
  75. border-bottom-color: rgba($color: #000000, $alpha: 0) !important;
  76. animation: spin 0.6s linear normal infinite;
  77. }
  78. .loading-anim .in {
  79. top: 25%;
  80. left: 25%;
  81. width: 50%;
  82. height: 50%;
  83. border-top-color: transparent !important;
  84. border-bottom-color: transparent !important;
  85. animation: spin 0.8s linear infinite;
  86. }
  87. .loading-anim .mid {
  88. top: 40%;
  89. left: 40%;
  90. width: 20%;
  91. height: 20%;
  92. border-left-color: transparent;
  93. border-right-color: transparent;
  94. animation: spin 0.6s linear infinite;
  95. }
  96. </style>