wupengfei
10 天以前 bae1e0d700497fc5bb88949b8b36b9049dfa1a27
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
  <div class="steps-wrapper">
    <el-steps :active="activeIndex" align-center finish-status="success" process-status="finish">
      <el-step v-for="item in stepList" :key="item" :title="item">
        <slot></slot>
      </el-step>
    </el-steps>
  </div>
</template>
 
<script setup lang="ts">
defineOptions({
  name: 'Steps',
});
 
type Props = {
  modelValue: number;
  stepList: string[];
};
 
const props = withDefaults(defineProps<Props>(), {});
 
const emit = defineEmits<{
  (e: 'update:modelValue', val: number): void;
}>();
 
const activeIndex = computed({
  get() {
    return props.modelValue;
  },
  set(val) {
    emit('update:modelValue', val);
  },
});
</script>
 
<style lang="scss" scoped>
@use '@/style/common.scss' as *;
 
.steps-wrapper {
  margin-top: 40px;
  padding-right: 80px;
}
 
:deep() {
  .el-step {
    --el-color-success: #{getCssVar('color', 'primary')};
 
    .el-step__head {
      .el-step__icon {
        &.is-text {
          border: none;
        }
 
        .el-step__icon-inner {
          font-weight: 500;
        }
      }
 
      &.is-finish {
        .el-step__icon {
          &.is-text {
            background: getCssVar('color', 'primary');
 
            .el-step__icon-inner {
              color: #ffffff;
            }
          }
        }
      }
 
      &.is-success {
        .el-step__icon {
          &.is-text {
            background: #e8efff;
          }
        }
 
        .el-step__line {
          border-bottom-color: getCssVar('color', 'primary');
        }
      }
 
      &.is-wait {
        .el-step__icon {
          &.is-text {
            background: #f0f0f0;
 
            .el-step__icon-inner {
              color: getCssVar('text-color', 'primary');
            }
          }
        }
      }
    }
 
    .el-step__line {
      right: calc(-50% + 22px);
      height: 0;
      border-bottom: 2px dashed getCssVar('text-color', 'placeholder');
      background-color: transparent;
 
      .el-step__line-inner {
        display: none;
      }
    }
 
    .el-step__main {
      position: absolute;
      top: 50%;
      left: 50%;
      padding-right: 10px;
      padding-left: 22px;
      background-color: #ffffff;
      transform: translateY(-50%);
      vertical-align: middle;
 
      .el-step__title {
        line-height: 25px;
        vertical-align: middle;
        width: max-content;
 
        &.is-finish {
          font-weight: bold;
        }
 
        &.is-success {
          color: getCssVar('text-color', 'primary');
        }
      }
 
      .el-step__description {
        display: none;
      }
    }
  }
}
</style>