app-step.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="app-step">
  3. <div class="step-list" :class="{'active' : index == i || index > i}" v-for="(item, i) in data" :key="i">
  4. <div class="step-num">{{ i + 1 }}</div>
  5. <div class="step-text">{{ item.text }}</div>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. name: 'app-step',
  12. props: {
  13. data: {
  14. type: Array,
  15. default: () => {
  16. return [
  17. {
  18. text: '创建头像'
  19. },
  20. {
  21. text: '生成手机号'
  22. },
  23. {
  24. text: '关注公众号'
  25. }
  26. ]
  27. }
  28. },
  29. // 当前步骤
  30. index: {
  31. type: Number,
  32. default: 0
  33. }
  34. }
  35. }
  36. </script>
  37. <style lang="scss" scoped>
  38. .app-step {
  39. @include disFlex(center, space-between);
  40. width: 100%;
  41. .step-list {
  42. position: relative;
  43. flex: 1;
  44. &.active {
  45. .step-num {
  46. color: #fff;
  47. background-color: $mainColor;
  48. }
  49. .step-text {
  50. color: $mainColor;
  51. }
  52. }
  53. .step-num {
  54. width: 32upx;
  55. height: 32upx;
  56. line-height: 30upx;
  57. text-align: center;
  58. border-radius: 50%;
  59. color: $fontColor3;
  60. background-color: #eeeeec;
  61. margin: 0 auto 14upx;
  62. }
  63. .step-text {
  64. color: $fontColor3;
  65. text-align: center;
  66. }
  67. &::before {
  68. position: absolute;
  69. left: calc(50% + 16upx);
  70. top: 16upx;
  71. display: inline-block;
  72. content: '';
  73. width: 100%;
  74. height: 2upx;
  75. background-color: #eeeeec;
  76. }
  77. &:last-child::before {
  78. width: 0;
  79. }
  80. }
  81. }
  82. </style>