2020-02-26 17:21:44 +08:00
|
|
|
---
|
|
|
|
order: 5
|
|
|
|
title:
|
|
|
|
zh-CN: 标签
|
|
|
|
en-US: Label
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
使用 `label` 标签单独展示时间。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Use `label` show time alone.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
|
|
|
import type { RadioChangeEvent } from 'antd';
|
2022-05-21 22:14:15 +08:00
|
|
|
import { Radio, Timeline } from 'antd';
|
|
|
|
import React, { useState } from 'react';
|
2020-02-26 17:21:44 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const [mode, setMode] = useState<'left' | 'alternate' | 'right'>('left');
|
2020-02-26 17:21:44 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const onChange = (e: RadioChangeEvent) => {
|
2020-02-26 17:21:44 +08:00
|
|
|
setMode(e.target.value);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Radio.Group
|
|
|
|
onChange={onChange}
|
|
|
|
value={mode}
|
|
|
|
style={{
|
|
|
|
marginBottom: 20,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Radio value="left">Left</Radio>
|
|
|
|
<Radio value="right">Right</Radio>
|
|
|
|
<Radio value="alternate">Alternate</Radio>
|
|
|
|
</Radio.Group>
|
|
|
|
<Timeline mode={mode}>
|
|
|
|
<Timeline.Item label="2015-09-01">Create a services</Timeline.Item>
|
|
|
|
<Timeline.Item label="2015-09-01 09:12:11">Solve initial network problems</Timeline.Item>
|
|
|
|
<Timeline.Item>Technical testing</Timeline.Item>
|
|
|
|
<Timeline.Item label="2015-09-01 09:12:11">Network problems being solved</Timeline.Item>
|
|
|
|
</Timeline>
|
|
|
|
</>
|
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
};
|
2020-02-26 17:21:44 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
export default App;
|
2020-02-26 17:21:44 +08:00
|
|
|
```
|