
<view class="steps-wrap">
<view class="flex-box" v-for="(item, index) in list" :key="item.id">
<view :class="['number', isActive(item) ? 'active-number' : '']">{{ index + 1 }}</view>
<view :class="['desc', isActive(item) ? 'active-desc' : '']">{{ item.title }}</view>
<view v-if="index < list.length - 1"
:class="['line', isActive(list[index + 1]) ? 'line3' : 'line1']"></view>
</view>
</view>
import { ref , computed } from "vue";
const list = ref([
{id:1 ,title: '提交申请'},
{id:2 ,title: '审核中'},
{id:3 ,title: '审核通过'},
{id:4 ,title: '退款中'},
{id:5 ,title: '退款成功'},
])
const active = ref(2)
const isActive = computed(() => {
return (item) => item.id <= active.value;
});
.steps-wrap {
padding: 36rpx 0 0;
display: flex;
align-items: center;
.flex-box {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.number {
position: relative;
z-index: 5;
width: 40rpx;
height: 40rpx;
background: #e5e5e5;
color: #fff;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
}
.active-number {
background: #3283EC;
}
.desc {
font-size: 24rpx;
color: #c8c8c8;
line-height: 34rpx;
margin-top: 20rpx;
font-weight: 500;
text-align: center;
}
.active-desc {
color: #484848;
}
.line {
position: absolute;
top: 18rpx;
left: 50%;
z-index: 1;
width: 100%;
height: 4rpx;
}
.line1 {
// background: linear-gradient(90deg, #3a9aff 0%, #9cccff 21%, #9cccff);
background: #e9e9e9;
}
.line2 {
background: #9cccff;
}
.line3 {
background:#3283EC;
}
}