FullscreenSpin.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div class="fullscreen-spin" :class="{ 'mask': mask }" v-if="loading">
  3. <div class="spin">
  4. <div class="spinner"></div>
  5. <div class="text">{{tip}}</div>
  6. </div>
  7. </div>
  8. </template>
  9. <script lang="ts" setup>
  10. withDefaults(defineProps<{
  11. loading?: boolean
  12. mask?: boolean
  13. tip?: string
  14. }>(), {
  15. loading: false,
  16. mask: true,
  17. tip: '',
  18. })
  19. </script>
  20. <style lang="scss" scoped>
  21. .fullscreen-spin {
  22. position: fixed;
  23. top: 0;
  24. bottom: 0;
  25. left: 0;
  26. right: 0;
  27. z-index: 100;
  28. display: flex;
  29. justify-content: center;
  30. align-items: center;
  31. &.mask {
  32. background-color: rgba($color: #f1f1f1, $alpha: .7);
  33. }
  34. }
  35. .spin {
  36. width: 200px;
  37. height: 200px;
  38. position: fixed;
  39. top: 50%;
  40. left: 50%;
  41. margin-top: -100px;
  42. margin-left: -100px;
  43. display: flex;
  44. flex-direction: column;
  45. justify-content: center;
  46. align-items: center;
  47. }
  48. .spinner {
  49. width: 36px;
  50. height: 36px;
  51. // border: 3px solid $themeColor;
  52. border: 3px solid #ff9300;
  53. border-top-color: transparent;
  54. border-radius: 50%;
  55. animation: spinner .8s linear infinite;
  56. }
  57. .text {
  58. margin-top: 20px;
  59. // color: $themeColor;
  60. color: #ff9300;
  61. }
  62. @keyframes spinner {
  63. 0% {
  64. transform: rotate(0deg);
  65. }
  66. 100% {
  67. transform: rotate(360deg);
  68. }
  69. }
  70. </style>