<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>
|