手动实现步骤条
步骤条
<template>
<div>
<ul class="steps">
<li
v-for="(item,index) in SetData"
:key="item+index"
:class="{'active':Steps===index+1}"
>{{ item + Steps }}
</li>
</ul>
</div>
</template>
<script>
export default {
props: ['SetData', 'Steps'],
data() {
return {}
},
methods: {}
}
</script>
<style>
/*创建步骤数字计数器*/
.steps {
position: relative;
margin-bottom: 30px;
counter-reset: step;
}
.steps li {
font-size: 12px;
list-style-type: none;
text-align: center;
width: 15%;
position: relative;
float: left;
}
.steps li:before {
display: block;
content: counter(step);
counter-increment: step;
width: 32px;
height: 32px;
background-color: #019875;
line-height: 32px;
border-radius: 50%;
font-size: 16px;
color: #fff;
text-align: center;
font-weight: 700;
margin: 0 auto 8px auto;
}
.steps li ~ li:after {
content: '';
width: 100%;
height: 2px;
background-color: #019875;
position: absolute;
left: -50%;
top: 16px;
z-index: -1; /*放置在数字后面*/
}
.steps li.active:before,
.steps li.active:after {
background-color: #019875;
}
.steps li.active ~ li:before,
.steps li.active ~ li:after {
background-color: #777;
}
</style>

浙公网安备 33010602011771号