2019-02-19 11:42:05 +08:00
|
|
|
---
|
|
|
|
order: 4
|
|
|
|
title:
|
|
|
|
zh-CN: 省略号
|
|
|
|
en-US: Ellipsis
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2021-01-12 16:46:59 +08:00
|
|
|
多行文本省略。你可以通过 `tooltip` 属性配置省略展示内容,大量文本时推荐优先使用 `expandable`。
|
2019-02-19 11:42:05 +08:00
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2021-01-12 16:46:59 +08:00
|
|
|
Multiple line ellipsis support. You can use `tooltip` to config ellipsis tooltip. Recommend `expandable` when have lots of content.
|
|
|
|
|
|
|
|
```tsx
|
2022-05-21 22:14:15 +08:00
|
|
|
import { Switch, Typography } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React, { useState } from 'react';
|
2021-01-12 16:46:59 +08:00
|
|
|
|
|
|
|
const { Paragraph, Text } = Typography;
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const [ellipsis, setEllipsis] = useState(true);
|
2021-01-12 16:46:59 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Switch
|
|
|
|
checked={ellipsis}
|
|
|
|
onChange={() => {
|
|
|
|
setEllipsis(!ellipsis);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Paragraph ellipsis={ellipsis}>
|
|
|
|
Ant Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team.
|
|
|
|
</Paragraph>
|
|
|
|
|
|
|
|
<Paragraph ellipsis={ellipsis ? { rows: 2, expandable: true, symbol: 'more' } : false}>
|
|
|
|
Ant Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team. Ant
|
|
|
|
Design, a design language for background applications, is refined by Ant UED Team.
|
|
|
|
</Paragraph>
|
|
|
|
|
|
|
|
<Text
|
|
|
|
style={ellipsis ? { width: 100 } : undefined}
|
|
|
|
ellipsis={ellipsis ? { tooltip: 'I am ellipsis now!' } : false}
|
|
|
|
>
|
|
|
|
Ant Design, a design language for background applications, is refined by Ant UED Team.
|
|
|
|
</Text>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
export default App;
|
2019-02-19 11:42:05 +08:00
|
|
|
```
|