StepList.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="step">
  3. <div class="step-list">
  4. <div class="step-item" v-for="i in options.length" :key="i" :style="{ width: 100 / options.length + '%' }">
  5. <div :class="['item-li', currentStep <= i ? '' : 'ok', currentStep === i ? 'active' : '']">
  6. <em :class="[i == 1 ? '' : 'step-dash step-dash1']"></em>
  7. <img v-if="currentStep > i" src="@/assets/images/success.png" alt="" />
  8. <span v-else></span>
  9. <em :class="[i == options.length ? '' : 'step-dash step-dash2']"></em>
  10. </div>
  11. </div>
  12. </div>
  13. <div class="step-ul">
  14. <div class="step-li" v-for="t in options" :key="t" :style="{ width: 100 / options.length + '%' }">{{ t }}</div>
  15. </div>
  16. </div>
  17. </template>
  18. <script setup lang="ts">
  19. const props = defineProps<{
  20. currentStep: number
  21. options: Array<string>
  22. }>()
  23. </script>
  24. <style scoped lang="scss">
  25. .step {
  26. padding-bottom: 16px;
  27. .step-list {
  28. display: flex;
  29. align-items: center;
  30. .step-item {
  31. display: flex;
  32. justify-content: center;
  33. align-items: center;
  34. .item-li {
  35. display: flex;
  36. width: 100%;
  37. justify-content: center;
  38. align-items: center;
  39. span {
  40. display: inline-block;
  41. width: 24px;
  42. height: 24px;
  43. aspect-ratio: 1/1;
  44. border-radius: 64px;
  45. border: 2px solid #beb6b6;
  46. position: relative;
  47. &::after {
  48. position: absolute;
  49. top: 50%;
  50. left: 50%;
  51. transform: translate(-50%, -50%);
  52. content: '';
  53. width: 4px;
  54. height: 4px;
  55. border-radius: 50%;
  56. background: #beb6b6;
  57. }
  58. }
  59. em {
  60. height: 2px;
  61. flex: 1 0 0;
  62. background: transparent;
  63. }
  64. .step-dash {
  65. height: 2px;
  66. flex: 1 0 0;
  67. background: #beb6b6;
  68. }
  69. img {
  70. display: inline-block;
  71. width: 24px;
  72. height: 24px;
  73. }
  74. }
  75. .active {
  76. span {
  77. display: inline-block;
  78. width: 24px;
  79. height: 24px;
  80. aspect-ratio: 1/1;
  81. border-radius: 64px;
  82. border: 2px solid #ff4766;
  83. position: relative;
  84. &::after {
  85. position: absolute;
  86. top: 50%;
  87. left: 50%;
  88. transform: translate(-50%, -50%);
  89. content: '';
  90. width: 4px;
  91. height: 4px;
  92. border-radius: 50%;
  93. background: #ff4766;
  94. }
  95. }
  96. em {
  97. height: 2px;
  98. flex: 1 0 0;
  99. background: transparent;
  100. }
  101. .step-dash {
  102. height: 2px;
  103. flex: 1 0 0;
  104. background: #beb6b6;
  105. }
  106. .step-dash1 {
  107. background: #ff4766;
  108. }
  109. }
  110. .ok {
  111. span {
  112. display: inline-block;
  113. width: 24px;
  114. height: 24px;
  115. aspect-ratio: 1/1;
  116. border-radius: 64px;
  117. border: 2px solid #ff4766;
  118. position: relative;
  119. &::after {
  120. position: absolute;
  121. top: 50%;
  122. left: 50%;
  123. transform: translate(-50%, -50%);
  124. content: '';
  125. width: 4px;
  126. height: 4px;
  127. border-radius: 50%;
  128. background: #ff4766;
  129. }
  130. }
  131. em {
  132. height: 2px;
  133. flex: 1 0 0;
  134. background: transparent;
  135. }
  136. .step-dash {
  137. height: 2px;
  138. flex: 1 0 0;
  139. background: #ff4766;
  140. }
  141. }
  142. }
  143. }
  144. .step-ul {
  145. display: flex;
  146. justify-content: space-between;
  147. align-items: flex-start;
  148. color: #474747;
  149. text-align: center;
  150. font-family: Roboto;
  151. font-size: 14px;
  152. font-style: normal;
  153. font-weight: 400;
  154. line-height: 20px;
  155. letter-spacing: 0.014px;
  156. .step-li {
  157. text-align: center;
  158. }
  159. }
  160. }
  161. </style>