2019-05-25 21:01:21 +08:00
|
|
|
|
---
|
|
|
|
|
order: 10
|
|
|
|
|
title:
|
|
|
|
|
zh-CN: 可点击
|
|
|
|
|
en-US: Clickable
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
|
|
设置 `onChange` 后,Steps 变为可点击状态。
|
|
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
|
|
Setting `onChange` makes Steps clickable.
|
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
|
```tsx
|
2022-05-23 14:37:16 +08:00
|
|
|
|
import { Divider, Steps } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
|
import React, { useState } from 'react';
|
2019-05-25 21:01:21 +08:00
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
|
const App: React.FC = () => {
|
|
|
|
|
const [current, setCurrent] = useState(0);
|
2019-05-25 21:01:21 +08:00
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
|
const onChange = (value: number) => {
|
2019-05-25 21:01:21 +08:00
|
|
|
|
console.log('onChange:', current);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
setCurrent(value);
|
2019-05-25 21:01:21 +08:00
|
|
|
|
};
|
2022-09-16 15:52:14 +08:00
|
|
|
|
const description = 'This is a description.';
|
2019-05-25 21:01:21 +08:00
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
|
return (
|
|
|
|
|
<>
|
2022-09-16 15:52:14 +08:00
|
|
|
|
<Steps
|
|
|
|
|
current={current}
|
|
|
|
|
onChange={onChange}
|
|
|
|
|
items={[
|
|
|
|
|
{
|
|
|
|
|
title: 'Step 1',
|
|
|
|
|
description,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Step 2',
|
|
|
|
|
description,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Step 3',
|
|
|
|
|
description,
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
/>
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
|
|
2022-09-16 15:52:14 +08:00
|
|
|
|
<Steps
|
|
|
|
|
current={current}
|
|
|
|
|
onChange={onChange}
|
|
|
|
|
direction="vertical"
|
|
|
|
|
items={[
|
|
|
|
|
{
|
|
|
|
|
title: 'Step 1',
|
|
|
|
|
description,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Step 2',
|
|
|
|
|
description,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Step 3',
|
|
|
|
|
description,
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
/>
|
2022-05-19 09:46:26 +08:00
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default App;
|
2019-05-25 21:01:21 +08:00
|
|
|
|
```
|