Skip to content

Steps 步骤条

介绍

拆分展示某项流程的步骤,引导用户按流程完成任务或向用户展示当前状态。

基础用法

html
<template>
  <nut-steps :current="current" @click-step="onStepClick">
    <nut-step>
      <template #title>步骤一</template>
    </nut-step>

    <nut-step title="未开始"></nut-step>
    <nut-step title="未开始"></nut-step>
  </nut-steps>
</template>
ts
const current = ref(1);

function onStepClick(index: number) {
  console.log("step-click", index);
}

基础用法(点状)

html
<template>
  <nut-steps :current="current" progress-dot>
    <nut-step></nut-step>
    <nut-step></nut-step>
    <nut-step></nut-step>
  </nut-steps>
</template>

标题和描述信息

html
<template>
  <nut-steps :current="current">
    <nut-step title="已完成" content="步骤描述"></nut-step>
    <nut-step title="进行中" content="步骤描述"></nut-step>
    <nut-step title="未开始" content="步骤描述"></nut-step>
  </nut-steps>
</template>

自定义图标

html
<template>
  <nut-steps current="1">
    <nut-step title="已完成">
      <template #icon>
        <nut-icon name="service"></nut-icon>
      </template>
    </nut-step>

    <nut-step title="进行中">
      <template #icon>
        <nut-icon name="people"></nut-icon>
      </template>
    </nut-step>

    <nut-step title="未开始">
      <template #icon>
        <nut-icon name="location2"></nut-icon>
      </template>
    </nut-step>
  </nut-steps>
</template>

竖向步骤条

html
<template>
  <nut-steps current="2" direction="vertical">
    <nut-step title="已完成" content="您的订单已经打包完成,商品已发出"></nut-step>
    <nut-step title="进行中" content="您的订单正在配送途中"></nut-step>
    <nut-step title="未开始" content="收货地址为:北京市经济技术开发区科创十一街18号院京东大厦"></nut-step>
  </nut-steps>
</template>

点状步骤和垂直方向

html
<template>
  <nut-steps current="2" direction="vertical" progress-dot>
    <nut-step title="已完成" content="您的订单已经打包完成,商品已发出"></nut-step>
    <nut-step title="进行中" content="您的订单正在配送途中"></nut-step>
    <nut-step title="未开始">
      <template #content>
        <p>收货地址为:</p>
        <p>北京市经济技术开发区科创十一街18号院京东大厦</p>
      </template>
    </nut-step>
  </nut-steps>
</template>

API

Steps Props

参数说明类型可选值默认值
direction显示方向stringhorizontal / verticalhorizontal
current当前所在的步骤number / string-0
progress-dot点状步骤条boolean-false

Steps Events

事件名说明类型
click-step点击步骤的标题或图标时触发(index: number) => void

Step Props

参数说明类型可选值默认值
title流程步骤的标题string--
content流程步骤的描述性文字(支持富文本)string--

Step Slots

名称说明
title步骤标题
content步骤内容
icon步骤图标

主题定制

样式变量

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

名称默认值
--nut-steps-base-icon-width25px
--nut-steps-base-icon-height25px
--nut-steps-base-icon-line-height25px
--nut-steps-base-icon-font-size13px
--nut-steps-base-title-font-size14px
--nut-steps-base-line-color#909ca4
--nut-steps-base-title-color#909ca4
--nut-steps-base-title-margin-bottom10px
--nut-steps-base-content-font-size14px
--nut-steps-base-content-color#666
--nut-steps-wait-icon-bg-color#959fb1
--nut-steps-wait-icon-text-colorvar(--nut-white)
--nut-steps-wait-icon-colorvar(--nut-white)
--nut-steps-wait-head-color#909ca4
--nut-steps-wait-head-border-color#909ca4
--nut-steps-wait-content-color#909ca4
--nut-steps-finish-head-colorvar(--nut-primary-color)
--nut-steps-finish-head-border-colorvar(--nut-primary-color)
--nut-steps-finish-title-colorvar(--nut-primary-color)
--nut-steps-finish-line-backgroundvar(--nut-primary-color)
--nut-steps-finish-icon-text-colorvar(--nut-white)
--nut-steps-process-head-colorvar(--nut-white)
--nut-steps-process-head-border-colorvar(--nut-primary-color)
--nut-steps-process-title-colorvar(--nut-primary-color)
--nut-steps-process-icon-text-colorvar(--nut-primary-color)

MIT Licensed