html
<template>
<div>
<t-steps layout="vertical" :current="options.third" theme="dot" @change="onThirdChange">
<t-step-item
v-for="(step, index) in steps"
:key="index"
:title="getTitle('third', index)"
>
<template #content>
<div>{{ step.content }}</div>
</template>
</t-step-item>
</t-steps>
</div>
</template>
<script setup>
import { ref} from "vue";
const options = ref({
third: 2, // 当前步骤索引
});
// 自定义步骤数据
const steps = ref([
{ title: "步骤 1", content: "提交" },
{ title: "步骤 2", content: "团委审核" },
{ title: "步骤 3", content: "院级审核" },
{ title: "步骤 4", content: "校级审核" },
{ title: "步骤 5", content: "通过" },
]);
// 根据当前步骤索引计算步骤标题
function getTitle(type, index) {
if (index === options.value.third) {
return "当前步骤";
}
if (index < options.value.third) {
return "已完成";
}
return "未完成步骤";
}
// 更新当前步骤索引
function onThirdChange(index) {
options.value.third = index;
}
</script>
<style>
/* 在这里添加其他样式(如果需要) */
</style>