GlobalLoading.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <up-overlay :show="isLoading" :duration="400" :z-index="99999" :opacity="0.1">
  3. <view class="loading" @touchmove.stop.prevent>
  4. <!-- <up-loading-icon mode="circle" size="46" color="black"></up-loading-icon> -->
  5. <!-- <image class="loading-gif" src="/static/loading.gif" mode="aspectFit" /> -->
  6. <!-- <view class="loader-inner"></view> -->
  7. <view class="load_11">
  8. <view class="rect1"></view>
  9. <view class="rect2"></view>
  10. <view class="rect3"></view>
  11. <view class="rect4"></view>
  12. <view class="rect5"></view>
  13. </view>
  14. </view>
  15. </up-overlay>
  16. </template>
  17. <script setup>
  18. import { watch, computed } from "vue";
  19. import { useLoadingStore } from "@/store";
  20. const loadingStore = useLoadingStore();
  21. const props = defineProps({
  22. msg: Object,
  23. });
  24. const isLoading = computed(() => !!(loadingStore?.visible || props.msg?.show));
  25. watch(isLoading, (val) => {
  26. // #ifdef H5
  27. document.body.style.overflow = val ? "hidden" : "";
  28. // #endif
  29. });
  30. </script>
  31. <style lang="less" scoped>
  32. @import url("@/style.less");
  33. .loading {
  34. position: fixed;
  35. top: 0;
  36. left: 0;
  37. right: 0;
  38. bottom: 0;
  39. padding-bottom: constant(safe-area-inset-bottom); /* iOS < 11.2 */
  40. padding-bottom: env(safe-area-inset-bottom); /* iOS >= 11.2 */
  41. display: flex;
  42. justify-content: center;
  43. align-items: center;
  44. z-index: 99999;
  45. pointer-events: none;
  46. cursor: not-allowed;
  47. box-sizing: border-box;
  48. .loader-inner {
  49. width: 60px;
  50. height: 60px;
  51. border: 6px solid #dfe3eb;
  52. border-top: 6px solid @black;
  53. border-radius: 50%;
  54. animation: spin 1s linear infinite;
  55. }
  56. @keyframes spin {
  57. 0% {
  58. transform: rotate(0deg);
  59. }
  60. 100% {
  61. transform: rotate(360deg);
  62. }
  63. }
  64. .load_11 {
  65. width: 100rpx;
  66. height: 68rpx;
  67. display: inline-block;
  68. text-align: center;
  69. font-size: 20rpx;
  70. }
  71. .load_11 > view {
  72. &:last-child {
  73. margin-right: 0;
  74. }
  75. background-color: #000000;
  76. height: 100%;
  77. width: 10rpx;
  78. margin-right: 6rpx;
  79. display: inline-block;
  80. -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
  81. animation: sk-stretchdelay 1.2s infinite ease-in-out;
  82. }
  83. .load_11 .rect2 {
  84. -webkit-animation-delay: -1.1s;
  85. animation-delay: -1.1s;
  86. }
  87. .load_11 .rect3 {
  88. -webkit-animation-delay: -1s;
  89. animation-delay: -1s;
  90. }
  91. .load_11 .rect4 {
  92. -webkit-animation-delay: -0.9s;
  93. animation-delay: -0.9s;
  94. }
  95. .load_11 .rect5 {
  96. -webkit-animation-delay: -0.8s;
  97. animation-delay: -0.8s;
  98. }
  99. @-webkit-keyframes sk-stretchdelay {
  100. 0%,
  101. 40%,
  102. 100% {
  103. -webkit-transform: scaleY(0.4);
  104. }
  105. 20% {
  106. -webkit-transform: scaleY(1);
  107. }
  108. }
  109. @keyframes sk-stretchdelay {
  110. 0%,
  111. 40%,
  112. 100% {
  113. transform: scaleY(0.4);
  114. -webkit-transform: scaleY(0.4);
  115. }
  116. 20% {
  117. transform: scaleY(1);
  118. -webkit-transform: scaleY(1);
  119. }
  120. }
  121. }
  122. </style>