Skip to content

Steps 步骤条

用于引导用户按照流程完成任务,或向用户展示当前所处的步骤状态。

提示

wd-step 已直接支持 titleicondescription 插槽,无需再设置旧版的 *-slot 控制字段。

组件类型

基本用法

active 为当前步骤进度,对应步骤下标。

html
<wd-steps :active="0">
  <wd-step />
  <wd-step />
  <wd-step />
</wd-steps>

标题和描述信息

通过 titledescription 设置每个步骤的标题和描述。

html
<wd-steps :active="active" align-center>
  <wd-step title="步骤1" description="注册1个账号" />
  <wd-step title="步骤2" description="登录账号并绑定手机" />
  <wd-step title="步骤3" description="完善个人信息" />
</wd-steps>
<wd-button size="small" @click="nextStep">下一步</wd-button>
ts
const active = ref(0)

function nextStep() {
  active.value += 1
}

修改图标

通过 icon 设置步骤图标。

html
<wd-steps :active="1" align-center>
  <wd-step icon="settings" />
  <wd-step icon="list" />
  <wd-step icon="clock-circle" />
</wd-steps>

组件状态

修改状态

通过 status 设置指定步骤的状态。

html
<wd-steps :active="1" align-center>
  <wd-step title="绑定手机" />
  <wd-step title="重新绑定手机" status="error" />
  <wd-step title="步骤3" />
</wd-steps>

组件样式

水平居中

设置 align-center 水平居中,只对横向步骤条有效。

html
<wd-steps :active="0" align-center>
  <wd-step />
  <wd-step />
  <wd-step />
</wd-steps>

布局能力

竖向步骤条

设置 vertical 以垂直方向展示。

html
<wd-steps :active="1" vertical>
  <wd-step description="注册1个账号" />
  <wd-step description="登录账号并绑定手机" />
  <wd-step description="完善个人信息" />
</wd-steps>

特殊样式

点状步骤条

设置 dot 使用点状步骤条。

html
<wd-steps :active="1" align-center dot>
  <wd-step title="步骤1" description="注册1个账号" />
  <wd-step title="步骤2" description="登录账号并绑定手机" />
  <wd-step title="步骤3" description="完善个人信息" />
</wd-steps>

可控制的点状步骤条

点状步骤条支持通过外部 active 控制当前步骤。

html
<wd-steps :active="dotActive" align-center dot>
  <wd-step title="步骤1" description="注册一个账号" />
  <wd-step title="步骤2" description="登录账号并绑定手机" />
  <wd-step title="步骤3" description="完善个人信息" />
</wd-steps>

竖向点状步骤条

verticaldot 可以组合使用。

html
<wd-steps :active="1" vertical dot>
  <wd-step description="注册1个账号" />
  <wd-step description="登录账号并绑定手机" />
  <wd-step description="完善个人信息" />
</wd-steps>

Steps Attributes

参数说明类型默认值
active当前激活步骤下标number0
vertical是否垂直方向展示booleanfalse
dot是否使用点状步骤条booleanfalse
space步骤条间距,默认自动计算string''
align-center是否水平居中,只对横向步骤条有效booleanfalse
custom-class根节点自定义类名string''
custom-style根节点自定义样式string''

Step Attributes

参数说明类型默认值
title步骤标题,不传时显示默认文案string-
description步骤描述string-
icon步骤图标string-
status步骤状态,可选值为 finishedprocesserrorwaitStepStatus-
custom-class根节点自定义类名string''
custom-style根节点自定义样式string''

Steps Slots

name说明
defaultStep 列表

Step Slots

name说明
icon自定义步骤图标
title自定义步骤标题
description自定义步骤描述

主题定制

CSS 变量

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 全局配置

名称默认值描述
--wot-step-content-margin-top$spacing-super-tight内容区距头部的顶部外边距
--wot-step-vertical-content-margin-left$n-32垂直布局时内容区的左外边距
--wot-step-vertical-content-padding-bottom$n-20垂直布局时内容区的底部内边距
--wot-step-vertical-header-dot-top$n-6垂直布局且为点状指示器时,头部的顶部绝对定位距离
--wot-step-indicator-size$n-18圆形指示器的宽高尺寸
--wot-step-circle-border-radius$radius-radius-full圆形指示器的圆角大小
--wot-step-circle-bg$filled-strong等待 (wait) 状态下圆形指示器的背景色
--wot-step-process-bg$primary-6进行中 (process) 状态下圆形指示器的背景色
--wot-step-finished-bg$primary-1已完成 (finished) 状态下圆形指示器的背景色
--wot-step-error-bg$danger-main错误 (error) 状态下圆形指示器的背景色
--wot-step-circle-text-font-size$typography-label-size-main圆形指示器内部文本的字号
--wot-step-circle-text-line-height$typography-label-line--height-size-main圆形指示器内部文本的行高
--wot-step-circle-text-font-weight$font-weight-medium圆形指示器内部文本的字重
--wot-step-circle-text-color$text-secondary等待状态或默认状态下圆形指示器内文本颜色
--wot-step-circle-text-process-color$text-white进行中状态下圆形指示器内文本颜色
--wot-step-circle-text-finished-color$primary-6已完成状态下圆形指示器内文本颜色
--wot-step-circle-icon-size$n-12圆形指示器内置状态图标 (如完成时的对号或错误时的叉号) 的字号大小
--wot-step-icon-size$n-18外部自定义传入的图标 (通过 icon 属性) 的字号大小
--wot-step-icon-color$icon-auxiliary等待或默认状态下图标的颜色
--wot-step-icon-color-active$primary-6激活 (如 process 或 finished) 状态下图标的颜色
--wot-step-icon-error-color$danger-main错误 (error) 状态下图标的颜色
--wot-step-inactive-color$text-placeholder未激活部分的占位文本颜色
--wot-step-error-color$text-white错误状态整体的主色调(纯白文本场景下等使用)
--wot-step-line-spacing$spacing-tight连接线与两侧指示器之间的间距
--wot-step-line-color$border-main连接线的默认底色 (对应未激活的线段)
--wot-step-line-active-color$primary-6激活 (完成状态) 下连接线的颜色
--wot-step-dot-size$n-10点状指示器的宽高尺寸
--wot-step-dot-wait-bg$filled-strong等待 (wait) 状态下点状指示器的背景色
--wot-step-dot-process-bg$primary-6进行中 (process) 状态下点状指示器的背景色
--wot-step-dot-process-border-color$primary-3进行中 (process) 状态下点状指示器的描边颜色
--wot-step-dot-finished-bg$primary-3已完成 (finished) 状态下点状指示器的背景色
--wot-step-dot-finished-border-color$primary-6已完成 (finished) 状态下点状指示器的描边颜色
--wot-step-dot-error-bg$danger-main错误 (error) 状态下点状指示器的背景色
--wot-step-title-font-size$typography-body-size-main标题文本字号大小
--wot-step-title-line-height$typography-body-line--height-size-main标题文本行高
--wot-step-title-font-weight$font-weight-regular标题文本字重
--wot-step-title-color$text-secondary等待与完成状态下标题的颜色
--wot-step-title-color-active$primary-6进行中状态下标题的激活颜色
--wot-step-title-error-color$danger-main错误状态下标题的颜色
--wot-step-description-font-size$typography-label-size-main描述文本字号大小
--wot-step-description-line-height$typography-label-line--height-size-main描述文本行高
--wot-step-description-font-weight$font-weight-regular描述文本字重
--wot-step-description-color$text-secondary描述文本颜色
--wot-step-description-margin-top$spacing-super-tight描述文本距标题的距离
--wot-step-description-padding$padding-zero $padding-ultra-tight描述文本的内边距

源代码

文档
组件

Released under the MIT License.

Released under the MIT License.