zhangzengfei
2022-09-02 f997a7dc8e0f4ff2a22a39617cbea9d21d7f69c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<template>
  <div class="steps">
    <div
      class="step-box"
      v-for="(name, i) in titleList"
      :key="i"
      :class="getClass(i)"
    >
      <div class="head">
        <div class="num" v-if="activeIndex <= i">{{ i + 1 }}</div>
        <i v-else class="el-icon-circle-check"></i>
      </div>
      <div class="title">
        {{ name }}
      </div>
      <div class="line" v-if="i !== titleList.length - 1"></div>
    </div>
  </div>
</template>
 
<script>
export default {
  data() {
    return {};
  },
  props: {
    titleList: Array,
    activeIndex: {
      type: Number,
      default: 0,
    },
  },
  computed: {},
  methods: {
    getClass(i) {
      if (this.activeIndex == i) {
        return "active-box";
      } else if (this.activeIndex > i) {
        return "done-box";
      } else {
        return "";
      }
    },
  },
};
</script>
 
<style lang="scss" scoped>
.steps {
  display: flex;
  justify-content: center;
  margin-bottom: 50px;
  .step-box.done-box {
    .el-icon-circle-check {
      font-size: 24px;
      color: #0064ff;
    }
    .title {
      color: #0064ff;
    }
    .line {
      height: 2px;
      background: #0064ff;
    }
  }
  .step-box.active-box {
    .title {
      color: #0064ff;
      font-weight: 600;
    }
    .head {
      .num {
        border: 1px solid #0064ff;
        color: #ffffff;
        background: #0064ff;
      }
    }
  }
  .step-box {
    display: flex;
    align-items: center;
    margin-right: 16px;
    .head {
      margin-right: 14px;
      .num {
        width: 24px;
        height: 24px;
        border: 1px solid #999999;
        border-radius: 24px;
        color: #999999;
        font-size: 16px;
        text-align: center;
        line-height: 24px;
      }
    }
    .title {
      margin-right: 16px;
      font-size: 16px;
      line-height: 24px;
      color: #999999;
    }
    .line {
      height: 1px;
      width: 148px;
      background: #e9ebee;
    }
  }
}
</style>