--- 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. ```tsx import { Button, message, Steps } from 'antd'; import React, { useState } from 'react'; const steps = [ { title: 'First', content: 'First-content', }, { title: 'Second', content: 'Second-content', }, { title: 'Last', content: 'Last-content', }, ]; const App: React.FC = () => { const [current, setCurrent] = useState(0); const next = () => { setCurrent(current + 1); }; const prev = () => { setCurrent(current - 1); }; const items = steps.map(item => ({ key: item.title, title: item.title })); return ( <>
{steps[current].content}
{current < steps.length - 1 && ( )} {current === steps.length - 1 && ( )} {current > 0 && ( )}
); }; export default App; ``` ```css .steps-content { min-height: 200px; margin-top: 16px; padding-top: 80px; text-align: center; background-color: #fafafa; border: 1px dashed #e9e9e9; border-radius: 2px; } .steps-action { margin-top: 24px; } ```