ant-design/components/steps/demo/clickable.md
2022-05-23 14:37:16 +08:00

1.1 KiB
Raw Blame History

order title
10
zh-CN en-US
可点击 Clickable

zh-CN

设置 onChangeSteps 变为可点击状态。

en-US

Setting onChange makes Steps clickable.

import { Divider, Steps } from 'antd';
import React, { useState } from 'react';

const { Step } = Steps;

const App: React.FC = () => {
  const [current, setCurrent] = useState(0);

  const onChange = (value: number) => {
    console.log('onChange:', current);
    setCurrent(value);
  };

  return (
    <>
      <Steps current={current} onChange={onChange}>
        <Step title="Step 1" description="This is a description." />
        <Step title="Step 2" description="This is a description." />
        <Step title="Step 3" description="This is a description." />
      </Steps>

      <Divider />

      <Steps current={current} onChange={onChange} direction="vertical">
        <Step title="Step 1" description="This is a description." />
        <Step title="Step 2" description="This is a description." />
        <Step title="Step 3" description="This is a description." />
      </Steps>
    </>
  );
};

export default App;