mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
Add overflowCount for badge, close #660
This commit is contained in:
parent
dd050bed0c
commit
5e18c37cce
@ -8,10 +8,10 @@ class AntBadge extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
let { count, prefixCls } = this.props;
|
||||
let { count, prefixCls, overflowCount } = this.props;
|
||||
const dot = this.props.dot;
|
||||
|
||||
count = count >= 100 ? '99+' : count;
|
||||
count = count > overflowCount ? '${overflowCount}+' : count;
|
||||
|
||||
// dot mode don't need count
|
||||
if (dot) {
|
||||
@ -43,6 +43,7 @@ AntBadge.defaultProps = {
|
||||
prefixCls: 'ant-badge',
|
||||
count: null,
|
||||
dot: false,
|
||||
overflowCount: 99,
|
||||
};
|
||||
|
||||
AntBadge.propTypes = {
|
||||
@ -51,6 +52,7 @@ AntBadge.propTypes = {
|
||||
React.PropTypes.number
|
||||
]),
|
||||
dot: React.PropTypes.bool,
|
||||
overflowCount: React.PropTypes.number,
|
||||
};
|
||||
|
||||
export default AntBadge;
|
||||
|
@ -22,5 +22,6 @@
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|----------------|----------------------------------|------------|---------|--------|
|
||||
| count | 展示的数字,大于 99 时显示为 99+,为 0 时隐藏 | Number | | |
|
||||
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | Number | | |
|
||||
| overflowCount | 展示封顶的数字值 | Number | | 99 |
|
||||
| dot | 不展示数字,只有一个小红点 | boolean | | false |
|
||||
|
Loading…
Reference in New Issue
Block a user