cwg-progress.vue 987 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <u-overlay :show="visible">
  3. <view class="overlay-center">
  4. <view class="progress-box">
  5. <u-loading-icon :text="text" textSize="18" />
  6. <u-line-progress :percentage="progress" activeColor="#ea002a" inactiveColor="#ececec" :showText="false"
  7. height="4" />
  8. </view>
  9. </view>
  10. </u-overlay>
  11. </template>
  12. <script setup lang="ts">
  13. import { useProgress } from '@/hooks/useProgress'
  14. // 使用全局进度管理
  15. const { visible, progress, text } = useProgress()
  16. </script>
  17. <style lang="scss" scoped>
  18. .overlay-center {
  19. position: fixed;
  20. left: 0;
  21. top: 0;
  22. width: 100vw;
  23. height: 100vh;
  24. display: flex;
  25. align-items: center; // 垂直居中
  26. justify-content: center; // 水平居中
  27. }
  28. .progress-box {
  29. width: 70%;
  30. max-width: 600rpx;
  31. display: flex;
  32. flex-direction: column;
  33. align-items: center;
  34. gap: 20px;
  35. padding: 40px;
  36. background: #fff;
  37. border-radius: 12px;
  38. }
  39. :deep(.u-line-progress) {
  40. width: 100%;
  41. }
  42. </style>