Skip to content

t-steps

Steps 步骤条

组件介绍

t-steps 用于展示操作流程的步骤进度,引导用户按步骤完成任务。支持横向和纵向布局,支持内容自适应和子组件样式主题覆盖父组件样式主题。

平台兼容

HarmonyH5AndroidiOS小程序UTS

基础用法

基础用法参考 demo/steps/steps.uvue,配合 t-steps-item 子组件使用。

vue
<template>
  <view class="steps-demo">
    <!-- 横向步骤条 -->
    <t-steps :current="current" type="primary">
      <t-steps-item title="步骤1" desc="描述信息"></t-steps-item>
      <t-steps-item title="步骤2" desc="描述信息"></t-steps-item>
      <t-steps-item title="步骤3" desc="描述信息"></t-steps-item>
    </t-steps>
    
    <!-- 纵向步骤条 -->
    <t-steps :current="current" direction="vertical" type="success">
      <t-steps-item title="提交订单" time="2024-01-01 10:00"></t-steps-item>
      <t-steps-item title="商家发货" time="2024-01-01 12:00"></t-steps-item>
      <t-steps-item title="运输中" time="2024-01-02 08:00"></t-steps-item>
      <t-steps-item title="已签收" time="2024-01-03 14:00"></t-steps-item>
    </t-steps>
  </view>
</template>

<script setup>
const current = ref(2);
</script>

<style scoped>
.steps-demo {
  padding: 40rpx;
}
</style>

Props

属性名说明类型默认值
path点击组件后跳转的页面路径;为空时仅响应事件string''
hover是否启用点击效果booleanfalse
type组件主题类型,可选 infoprimaryerrorwarningsuccessstring''
disabled是否禁用booleanfalse
effect组件显示主题,可选 normaldarklightplainstring'normal'
size组件尺寸,可选 largemediumsmallministring'medium'
direction布局方向,可选 horizontalverticalstring'horizontal'
current当前步骤索引(从1开始)number2
activeColor激活状态文字颜色string''
activeIcon激活状态图标名称string'checkbox-mark'
activeIconClass激活图标的样式类string''
barClass步骤条的样式类string''
indexClass步骤索引的样式类string''
inactiveColor未激活状态文字颜色string'#dedede'
showIndex是否显示序号booleantrue
isEvenlyDistributed是否每项均匀分布booleanfalse

Events

事件名说明回调参数
click点击时触发-
transitionend动画结束时触发-
initFinished组件初始化完成时触发-
touchstart触摸开始时触发-
touchend触摸结束时触发-
touchmove触摸移动时触发-
touchcancel触摸取消时触发-

Slots

插槽名说明
default步骤条内容,放置 t-steps-item 子组件

外部类

类名说明
active-icon-class激活图标样式类
bar-class步骤条样式类
index-class步骤索引样式类