TDesign 步骤条用法

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值