mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 09:49:57 +08:00
1ebf5fa4b7
* feat:Typography add suffix * feat:run test * fix:lint * feat: update suffix example * feat: update test * fix: updateupdateSnapshot * fix: upate test * run lint * feat: measureSuffixText * feat: suffix 不可省略 * fix: title * fix: update node_modules * fix: change title type
54 lines
969 B
Markdown
54 lines
969 B
Markdown
---
|
|
order: 100
|
|
title:
|
|
zh-CN: 后缀
|
|
en-US: suffix
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
添加后缀的省略。
|
|
|
|
## en-US
|
|
|
|
add suffix ellipsis support.
|
|
|
|
```jsx
|
|
import { Typography, Slider } from 'antd';
|
|
|
|
const { Paragraph } = Typography;
|
|
|
|
class Demo extends React.Component {
|
|
state = {
|
|
rows: 1,
|
|
};
|
|
|
|
onChange = rows => {
|
|
this.setState({ rows });
|
|
};
|
|
|
|
render() {
|
|
const { rows } = this.state;
|
|
const article =
|
|
'To be, or not to be, that is a question: Whether it is nobler in the mind to suffer. The slings and arrows of outrageous fortune';
|
|
return (
|
|
<div>
|
|
<Slider value={rows} min={1} max={10} onChange={this.onChange} />
|
|
<Paragraph
|
|
ellipsis={{
|
|
rows,
|
|
expandable: true,
|
|
suffix: '--William Shakespeare',
|
|
}}
|
|
title={`${article}--William Shakespeare`}
|
|
>
|
|
{article}
|
|
</Paragraph>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
ReactDOM.render(<Demo />, mountNode);
|
|
```
|