fs-loading.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="fs-loading" :style="{ backgroundColor: bgColor }">
  3. <view>
  4. <view class="loader"></view>
  5. <slot></slot>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. /**
  11. * 加载组件
  12. * @description 加载组件
  13. * @property {String} bgColor 背景色
  14. */
  15. export default {
  16. name: 'fs-loading'
  17. }
  18. </script>
  19. <script setup>
  20. const props = defineProps({
  21. bgColor: {
  22. type: String,
  23. default: 'rgba(0,0,0,.5)'
  24. }
  25. })
  26. </script>
  27. <style lang="scss" scoped>
  28. .fs-loading {
  29. position: absolute;
  30. top: 0;
  31. left: 0;
  32. text-align: center;
  33. width: 100%;
  34. height: 100%;
  35. display: flex;
  36. align-items: center;
  37. justify-content: center;
  38. color: #fff;
  39. z-index: 20;
  40. }
  41. .loader {
  42. margin: 0 auto 20rpx;
  43. font-size: 12rpx;
  44. position: relative;
  45. border-top: 1em solid rgba(255, 255, 255, 0.2);
  46. border-right: 1em solid rgba(255, 255, 255, 0.2);
  47. border-bottom: 1em solid rgba(255, 255, 255, 0.2);
  48. border-left: 1em solid #fff;
  49. animation: load8 1s infinite linear;
  50. }
  51. .loader,
  52. .loader:after {
  53. border-radius: 50%;
  54. width: 10em;
  55. height: 10em;
  56. }
  57. @keyframes load8 {
  58. 0% {
  59. transform: rotate(0deg);
  60. }
  61. 100% {
  62. transform: rotate(360deg);
  63. }
  64. }
  65. </style>