简体中文
FxSteps
约 1058 字大约 4 分钟
2025-12-16
引导用户按照流程完成任务的分步导航条,可根据实际应用场景设定步骤,步骤不得少于 2 步。
Steps Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| space | 每个 step 的间距,不填写将自适应间距。支持百分比。 | number / string | — | — |
| direction | 显示方向 | string | vertical/horizontal | horizontal |
| active | 设置当前激活步骤 | number | — | 0 |
| process-status | 设置当前步骤的状态 | string | wait / process / finish / error / success | process |
| finish-status | 设置结束步骤的状态 | string | wait / process / finish / error / success | finish |
| align-center | 进行居中对齐 | boolean | - | false |
| simple | 是否应用简洁风格 | boolean | - | false |
Step Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| title | 标题 | string | — | — |
| description | 描述性文字 | string | — | — |
| icon | 图标 | 传入 icon 的 class 全名来自定义 icon,也支持 slot 方式写入 | string | — |
| status | 设置当前步骤的状态,不设置则根据 steps 确定状态 | wait / process / finish / error / success | - |
Step Slot
| name | 说明 |
|---|---|
| icon | 自定义图标 |
| title | 自定义标题 |
| description | 自定义描述性文字 |
基础用法
简单的步骤条。
<fx-steps :active="active" finish-status="success">
<fx-step title="步骤 1"></fx-step>
<fx-step title="步骤 2"></fx-step>
<fx-step title="步骤 3"></fx-step>
</fx-steps>
<fx-button style="margin-top: 12px;" @click="next">下一步</fx-button>
<script>
export default {
data() {
return {
active: 0
};
},
methods: {
next() {
if (this.active++ > 2) this.active = 0;
}
}
}
</script>含状态步骤条
每一步骤显示出该步骤的状态。
<fx-steps :space="200" :active="1" finish-status="success">
<fx-step title="已完成"></fx-step>
<fx-step title="进行中"></fx-step>
<fx-step title="步骤 3"></fx-step>
</fx-steps>有描述的步骤条
每个步骤有其对应的步骤状态描述。
<fx-steps :active="1">
<fx-step title="步骤 1" description="这是一段很长很长很长的描述性文字"></fx-step>
<fx-step title="步骤 2" description="这是一段很长很长很长的描述性文字"></fx-step>
<fx-step title="步骤 3" description="这段就没那么长了"></fx-step>
</fx-steps>居中的步骤条
标题和描述都将居中。
<fx-steps :active="2" align-center>
<fx-step title="步骤1" description="这是一段很长很长很长的描述性文字"></fx-step>
<fx-step title="步骤2" description="这是一段很长很长很长的描述性文字"></fx-step>
<fx-step title="步骤3" description="这是一段很长很长很长的描述性文字"></fx-step>
<fx-step title="步骤4" description="这是一段很长很长很长的描述性文字"></fx-step>
</fx-steps>带图标的步骤条
步骤条内可以启用各种自定义的图标。
<fx-steps :active="1">
<fx-step title="步骤 1" icon="el-icon-edit"></fx-step>
<fx-step title="步骤 2" icon="el-icon-upload"></fx-step>
<fx-step title="步骤 3" icon="el-icon-picture"></fx-step>
</fx-steps>竖式步骤条
竖直方向的步骤条。
<div style="height: 300px;">
<fx-steps direction="vertical" :active="1">
<fx-step title="步骤 1"></fx-step>
<fx-step title="步骤 2"></fx-step>
<fx-step title="步骤 3" description="这是一段很长很长很长的描述性文字"></fx-step>
</fx-steps>
</div>简洁风格的步骤条
设置 simple 可应用简洁风格,该条件下 align-center / description / direction / space 都将失效。
<fx-steps :active="1" simple>
<fx-step title="步骤 1" icon="el-icon-edit"></fx-step>
<fx-step title="步骤 2" icon="el-icon-upload"></fx-step>
<fx-step title="步骤 3" icon="el-icon-picture"></fx-step>
</fx-steps>
<fx-steps :active="1" finish-status="success" simple style="margin-top: 20px">
<fx-step title="步骤 1" ></fx-step>
<fx-step title="步骤 2" ></fx-step>
<fx-step title="步骤 3" ></fx-step>
</fx-steps>