t-steps
Steps 步骤条
组件介绍
t-steps 用于展示操作流程的步骤进度,引导用户按步骤完成任务。支持横向和纵向布局,支持内容自适应和子组件样式主题覆盖父组件样式主题。
平台兼容
| Harmony | H5 | Android | iOS | 小程序 | 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 | 是否启用点击效果 | boolean | false |
type | 组件主题类型,可选 info、primary、error、warning、success | string | '' |
disabled | 是否禁用 | boolean | false |
effect | 组件显示主题,可选 normal、dark、light、plain | string | 'normal' |
size | 组件尺寸,可选 large、medium、small、mini | string | 'medium' |
direction | 布局方向,可选 horizontal、vertical | string | 'horizontal' |
current | 当前步骤索引(从1开始) | number | 2 |
activeColor | 激活状态文字颜色 | string | '' |
activeIcon | 激活状态图标名称 | string | 'checkbox-mark' |
activeIconClass | 激活图标的样式类 | string | '' |
barClass | 步骤条的样式类 | string | '' |
indexClass | 步骤索引的样式类 | string | '' |
inactiveColor | 未激活状态文字颜色 | string | '#dedede' |
showIndex | 是否显示序号 | boolean | true |
isEvenlyDistributed | 是否每项均匀分布 | boolean | false |
Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
click | 点击时触发 | - |
transitionend | 动画结束时触发 | - |
initFinished | 组件初始化完成时触发 | - |
touchstart | 触摸开始时触发 | - |
touchend | 触摸结束时触发 | - |
touchmove | 触摸移动时触发 | - |
touchcancel | 触摸取消时触发 | - |
Slots
| 插槽名 | 说明 |
|---|---|
default | 步骤条内容,放置 t-steps-item 子组件 |
外部类
| 类名 | 说明 |
|---|---|
active-icon-class | 激活图标样式类 |
bar-class | 步骤条样式类 |
index-class | 步骤索引样式类 |