import React from "react"; import styles from "./index.less"; import { Steps, Button, message } from "antd"; const { Step } = Steps; const steps = [ { title: "First", content: "First-content" }, { title: "Second", content: "Second-content" }, { title: "Last", content: "Last-content" } ]; class App extends React.Component { constructor(props) { super(props); this.state = { current: 0 }; } next() { const current = this.state.current + 1; this.setState({ current }); } prev() { const current = this.state.current - 1; this.setState({ current }); } render() { const { current } = this.state; return (
{steps.map(item => ( ))}
{steps[current].content}
{current < steps.length - 1 && ( )} {current === steps.length - 1 && ( )} {current > 0 && ( )}
); } } export default () => (
);