Skip to content
On this page

组件库文档 tmui.design

步骤条 Steps

步骤条,可以方便的预览逻辑,事务条理。需要配合tm-steps-item组件,必须放置tm-steps-item组件才能使用。


🌶️ 步骤条 Steps 示例

查看模拟效果
示例模板
vue
<template>
    <tm-app>
        <tm-sheet>
            <tm-text :fontSize="24" _class="font-weight-b" label="基础属性,更多玩法请前往文档。"></tm-text>
        </tm-sheet>
        <tm-sheet :padding="[0, 24]" :margin="[0, 0]" >
            <tm-steps color="primary"  :defaultCurrent="1">
                <tm-steps-item :width="150" :title="item.title" v-for="(item, index) in list" :key="index">
                </tm-steps-item>
            </tm-steps>
        </tm-sheet>

        <tm-sheet :padding="[0, 24]" :margin="[0, 0]" >
            <tm-steps type="number" activeColor="green" :defaultCurrent="2">
                <tm-steps-item :width="200" :title="item.title" v-for="(item, index) in list2" :key="index">
                </tm-steps-item>
            </tm-steps>
        </tm-sheet>

        <tm-sheet :padding="[0, 24]" :margin="[0, 0]" >
            <tm-steps changeable @step-click="test" activeColor="green" status="error" :defaultCurrent="1">
                <tm-steps-item :title="item.title" v-for="(item, index) in list2" :key="index">
                </tm-steps-item>
            </tm-steps>
        </tm-sheet>

    </tm-app>
</template>
<script lang="ts" setup>
import { ref, getCurrentInstance } from "vue"
import { onShow, onLoad } from "@dcloudio/uni-app";
import tmApp from "@/tmui/components/tm-app/tm-app.vue"
import tmSheet from "@/tmui/components/tm-sheet/tm-sheet.vue"
import tmText from "@/tmui/components/tm-text/tm-text.vue"
import tmDivider from "@/tmui/components/tm-divider/tm-divider.vue"
import tmSteps from "@/tmui/components/tm-steps/tm-steps.vue"
import tmStepsItem from "@/tmui/components/tm-steps-item/tm-steps-item.vue"
const list = ref([
    { title: "开始" },
    { title: "投放中" },
    { title: "审核" },
    { title: "最后审查" },
    { title: "完成" },
])
const list2 = ref([
    { title: "开始" },
    { title: "投放中" },
    { title: "审核" },
])
function test(){
	console.log(11)
}
</script>

🌶️ 兼容性

APP-VUEAPP-NVUE小程序WEB/H5VUE3/TS
✔️✔️✔️✔️✔️

🌱 参数

本组件含有公共属性 公共属性

参数名类型默认值描述
directionString"horizontal"步骤条显示的方向
horizontal | vertical
current[Number]0当前的步骤。可使用v-model:current
defaultCurrentNumber0当前默认初始,显示的步骤数。
statusString""当前步骤的状态。
wait | process | finish | error
showLineBooleantrue是否显示连线。
changeableBooleanfalse是否允许点击步骤来切换当前步骤数。
beforeStepChange[Function,Boolean]false当点击步骤切换前的勾子函数,返回fase将取消切换。可以返回Promise异步。
colorString'grey-3'未激活时的主题色
activeColorString'primary'激活时的主题色。
typeString'dot'样式dot,number

🌹 事件

事件名参数返回数据描述
change---value当前切换步骤时触发。
update:current------即v-model:current
step-click---index当点击步骤时触发。

🌱 Steps-item 参数

| color| [String ] | '' | 当前的主题,默认使用父组件的值 | | activeColor| [String ] | '' | 激活时的主题,默认使用父组件的值 | | title| [String ] | '' | 标题 | | label| [String ] | '' | 标题下方的描述文字 | | icon| [String ] | '' | 显示步骤图标,图标名称 | | size| [Number] | '' | 圆点的大小。 | | width| [Number] | 150 | 宽度。 |

🌽 slot插槽

默认default

🥗 ref方法

方法名参数返回值描述

😡 贡献者:小超1263375375