2019-02-19 11:42:05 +08:00
|
|
|
---
|
|
|
|
order: 99
|
|
|
|
title:
|
|
|
|
zh-CN: 省略号 Debug
|
|
|
|
en-US: Ellipsis Debug
|
|
|
|
debug: true
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
多行文本省略。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Multiple line ellipsis support.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-21 22:14:15 +08:00
|
|
|
import { Slider, Switch, Typography } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React, { useState } from 'react';
|
2019-02-19 11:42:05 +08:00
|
|
|
|
|
|
|
const { Text, Paragraph } = Typography;
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const [rows, setRows] = useState(1);
|
|
|
|
const [longText, setLongText] = useState(true);
|
|
|
|
const [copyable, setCopyable] = useState(false);
|
|
|
|
const [editable, setEditable] = useState(false);
|
|
|
|
const [expandable, setExpandable] = useState(false);
|
2019-02-19 11:42:05 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Switch checked={longText} checkedChildren="Long Text" onChange={setLongText} />
|
|
|
|
<Switch checked={copyable} onChange={setCopyable} />
|
|
|
|
<Switch checked={editable} onChange={setEditable} />
|
|
|
|
<Switch checked={expandable} onChange={setExpandable} />
|
|
|
|
<Slider value={rows} min={1} max={10} onChange={setRows} />
|
|
|
|
{longText ? (
|
|
|
|
<Paragraph ellipsis={{ rows, expandable }} copyable={copyable} editable={editable}>
|
|
|
|
Ant Design, a design language for background applications, is refined by Ant UED Team.
|
|
|
|
This is a nest sample{' '}
|
|
|
|
<Text code strong delete>
|
|
|
|
Test
|
|
|
|
</Text>{' '}
|
|
|
|
case. Bnt Design, a design language for background applications, is refined by Ant UED
|
|
|
|
Team. Cnt Design, a design language for background applications, is refined by Ant UED
|
|
|
|
Team. Dnt Design, a design language for background applications, is refined by Ant UED
|
|
|
|
Team. Ent Design, a design language for background applications, is refined by Ant UED
|
|
|
|
Team.
|
|
|
|
</Paragraph>
|
|
|
|
) : (
|
|
|
|
<Paragraph ellipsis={{ rows, expandable }} copyable={copyable} editable={editable}>
|
|
|
|
Hello World
|
|
|
|
</Paragraph>
|
|
|
|
)}
|
2019-02-19 11:42:05 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
<Text style={{ width: 100 }} ellipsis copyable>
|
|
|
|
Ant Design is a design language for background applications, is refined by Ant UED Team.
|
|
|
|
</Text>
|
2020-04-01 23:31:22 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
<p>
|
|
|
|
[Before]<Text ellipsis>not ellipsis</Text>[After]
|
|
|
|
</p>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
2022-01-18 14:13:41 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
export default App;
|
2019-02-19 11:42:05 +08:00
|
|
|
```
|