ant-design/components/typography/demo/suffix.md
zouxiaomingya 1ebf5fa4b7 feat: Typography add suffix (#20224)
* 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
2019-12-24 11:59:17 +08:00

969 B

order title
100
zh-CN en-US
后缀 suffix

zh-CN

添加后缀的省略。

en-US

add suffix ellipsis support.

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);