mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +08:00
65f067eb13
* feat: support items * feat: update demo * test: update package * test: update use type * test: update for test * test: update for lint * feat: update doc * test: update for lint * test: update for lint * test: update for lint * test: add deprecated dome * test: add deprecated dome * doc: update doc * feat: update package * test: add test case
77 lines
1.3 KiB
Markdown
77 lines
1.3 KiB
Markdown
---
|
||
order: 10
|
||
title:
|
||
zh-CN: 可点击
|
||
en-US: Clickable
|
||
---
|
||
|
||
## zh-CN
|
||
|
||
设置 `onChange` 后,Steps 变为可点击状态。
|
||
|
||
## en-US
|
||
|
||
Setting `onChange` makes Steps clickable.
|
||
|
||
```tsx
|
||
import { Divider, Steps } from 'antd';
|
||
import React, { useState } from 'react';
|
||
|
||
const App: React.FC = () => {
|
||
const [current, setCurrent] = useState(0);
|
||
|
||
const onChange = (value: number) => {
|
||
console.log('onChange:', current);
|
||
setCurrent(value);
|
||
};
|
||
const description = 'This is a description.';
|
||
|
||
return (
|
||
<>
|
||
<Steps
|
||
current={current}
|
||
onChange={onChange}
|
||
items={[
|
||
{
|
||
title: 'Step 1',
|
||
description,
|
||
},
|
||
{
|
||
title: 'Step 2',
|
||
description,
|
||
},
|
||
{
|
||
title: 'Step 3',
|
||
description,
|
||
},
|
||
]}
|
||
/>
|
||
|
||
<Divider />
|
||
|
||
<Steps
|
||
current={current}
|
||
onChange={onChange}
|
||
direction="vertical"
|
||
items={[
|
||
{
|
||
title: 'Step 1',
|
||
description,
|
||
},
|
||
{
|
||
title: 'Step 2',
|
||
description,
|
||
},
|
||
{
|
||
title: 'Step 3',
|
||
description,
|
||
},
|
||
]}
|
||
/>
|
||
</>
|
||
);
|
||
};
|
||
|
||
export default App;
|
||
```
|