Skip to content

Steps 步骤条

引导用户按顺序完成多阶段任务或表单向导的步骤条组件,支持数字序号指示器、小圆点模式、横向/纵向布局与动态切换控制。


代码示例

1. 基础横向步骤条 (Horizontal Steps)

绑定 :current:items,配合按钮控制步骤前进与后退。

vue
<template>
  <view>
    <mu-steps :current="currentStep" :items="stepItems" />
    
    <view class="actions">
      <mu-button size="small" :disabled="currentStep === 0" @click="currentStep--">
        上一步
      </mu-button>
      <mu-button size="small" type="primary" :disabled="currentStep === stepItems.length - 1" @click="currentStep++">
        {{ currentStep === stepItems.length - 1 ? '完成' : '下一步' }}
      </mu-button>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue'

const currentStep = ref(1)
const stepItems = ref([
  { title: '实名认证', desc: '上传身份证' },
  { title: '填写信息', desc: '补充基本资料' },
  { title: '人工审核', desc: '预计 10 分钟' },
  { title: '完成开通', desc: '正式开启权限' }
])
</script>

2. 小圆点步骤条 (Dot Steps)

设置 :show-number="false" 隐藏内部数字编号,展示极简圆点状态。

vue
<template>
  <mu-steps :current="1" :show-number="false" :items="stepItems" active-color="#10B981" />
</template>

3. 垂直步骤条 (Vertical Steps)

设置 direction="vertical" 开启纵向垂直表单引导模式。

vue
<template>
  <mu-steps direction="vertical" :current="1" :items="verticalSteps" active-color="#8B5CF6" />
</template>

API 属性说明 (Props)

参数名说明类型可选值默认值
current当前激活的步骤索引(从 0 开始)Number-0
items / steps步骤数据源列表 [{ title, desc, time }]Array-[]
direction步骤条展示方向Stringhorizontal (横向) | vertical (纵向)'horizontal'
showNumber是否在节点内部显示 1, 2, 3 数字编号Booleantrue | falsetrue
activeColor完成态与当前进行态主题颜色String-'#171717'
reverse是否倒序展示步骤Booleantrue | falsefalse

步骤项数据结构 (Item Object)

字段名说明类型
title步骤标题String
desc / description步骤详细描述文案String
time / date步骤关联的时间/日期文本String

基于 MIT 协议开源发行

H5 模拟器 (steps)☀️🔄