progress.uvue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="progress-container">
  3. <view class="progress-bar" v-for="i in num" :key="i" :class="{
  4. 'progress-select':percentage>=i
  5. }">
  6. <view class="progress-fill"></view>
  7. <view class="progress-thumb" v-if="i!==num"></view>
  8. </view>
  9. </view>
  10. </template>
  11. <script lang="ts" setup>
  12. import { ref, defineProps } from 'vue';
  13. const props = defineProps({
  14. percentage: {
  15. type: Number,
  16. default: 2
  17. },
  18. num:{
  19. type:Number,
  20. default:4
  21. },
  22. size:{
  23. type:String,
  24. default:'15px'
  25. }
  26. });
  27. </script>
  28. <style lang="scss" scoped>
  29. .progress-container {
  30. width: 100%;
  31. padding: 10rpx 0;
  32. @apply flex flex-row;
  33. .progress-bar {
  34. @apply flex flex-row items-center;
  35. .progress-fill {
  36. @apply rounded-full ;
  37. background-color: #E4F0FF;
  38. width:v-bind(size);
  39. height:v-bind(size);
  40. }
  41. .progress-thumb {
  42. @apply rounded-full ;
  43. width:v-bind(size);
  44. height:calc(v-bind(size) / 5);
  45. background-color: #E4F0FF;
  46. }
  47. }
  48. .progress-select{
  49. .progress-fill {
  50. background-color: #194DCF;
  51. }
  52. .progress-thumb {
  53. background-color: #194DCF;
  54. }
  55. }
  56. }
  57. </style>