You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< docs >
-- -
order : 3
title :
zh - CN : 步骤切换
en - US : Switch Step
-- -
# # zh - CN
通常配合内容及按钮使用 , 表示一个流程的处理进度 。
# # en - US
Cooperate with the content and buttons , to represent the progress of a process .
< / docs >
< template >
< div >
< a -steps :current ="current" :items ="items" > < / a - s t e p s >
< div class = "steps-content" >
{ { steps [ current ] . content } }
< / div >
< div class = "steps-action" >
< a -button v-if ="current < steps.length - 1" type="primary" @click="next">Next</a-button>
<a-button
v-if="current == steps.length - 1"
type="primary"
@click="message.success('Processing complete!')"
>
Done
</a-button>
<a-button v-if="current > 0" style="margin-left: 8px" @click="prev" > Previous < / a -button >
< / div >
< / div >
< / template >
< script lang = "ts" setup >
import { ref } from 'vue' ;
import { message } from 'ant-design-vue' ;
const current = ref < number > ( 0 ) ;
const next = ( ) => {
current . value ++ ;
} ;
const prev = ( ) => {
current . value -- ;
} ;
const steps = [
{
title : 'First' ,
content : 'First-content' ,
} ,
{
title : 'Second' ,
content : 'Second-content' ,
} ,
{
title : 'Last' ,
content : 'Last-content' ,
} ,
] ;
const items = steps . map ( item => ( { key : item . title , title : item . title } ) ) ;
< / script >
< style scoped >
. steps - content {
margin - top : 16 px ;
border : 1 px dashed # e9e9e9 ;
border - radius : 6 px ;
background - color : # fafafa ;
min - height : 200 px ;
text - align : center ;
padding - top : 80 px ;
}
. steps - action {
margin - top : 24 px ;
}
[ data - theme = 'dark' ] . steps - content {
background - color : # 2 f2f2f ;
border : 1 px dashed # 404040 ;
}
< / style >