fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
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
<template>
  <el-row class="customSteps">
     <el-col class="itemStep"
        v-for="(item,index) in stepArr"
        :key="index"
        :span="parseInt(24/stepArr.length)"
        :class="['itemStep', index !== stepArr.length - 1 ? 'noLastStep' : '', index !== 0 ? 'noFirstStep' : '',item.stepFinsh]"
      >
        <span>{{item.name}}</span>
     </el-col>
  </el-row>
</template>
 
<script>
export default {
  props: {
    // 步骤条数组
    stepArr: {
      type: Array,
      default: function () {
        return []
      }
    },
    activeIndex: {
      type: Number,
      default: 0
    }
  },
  watch: {
    activeIndex: {
      handler (newValue) {
        const activeIndex = --newValue
        this.stepArr.forEach((item, index) => {
          if (index <= activeIndex) {
            this.$set(item, 'stepFinsh', 'stepFinsh')
          } else {
            this.$set(item, 'stepFinsh', '')
          }
        })
      },
      immediate: true
    }
  }
}
</script>
 
<style lang="scss">
 .customSteps{
    font-weight: 600;
    color: #333333;
    font-size: 14px;
   .itemStep{
     height: 50px;
     line-height: 50px;
     text-align: center;
     position: relative;
     background: #ffffff;
     &.noLastStep::after{
      content: '';
      position: absolute;
      right: 0;
      border-top: 25px solid #F2F2F2;
      border-bottom: 25px solid #F2F2F2;
      border-left: 25px solid #ffffff;
    }
    &.noFirstStep::before{
      content: '';
      position: absolute;
      left: 0;
      border-top: 25px solid transparent;
      border-bottom: 25px solid transparent;
      border-left: 25px solid #F2F2F2;
    }
   }
   .stepFinsh{
     background-color: #C2A16C;
     color: #ffffff;
      &.noLastStep::after{
       border-left-color:#C2A16C ;
     }
   }
 }
</style>