diff --git a/components/badge/index.jsx b/components/badge/index.jsx index 3aaa743053..0b9f9d480e 100644 --- a/components/badge/index.jsx +++ b/components/badge/index.jsx @@ -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; diff --git a/components/badge/index.md b/components/badge/index.md index a165fd979e..ed2d5fc2ce 100644 --- a/components/badge/index.md +++ b/components/badge/index.md @@ -22,5 +22,6 @@ | 参数 | 说明 | 类型 | 可选值 | 默认值 | |----------------|----------------------------------|------------|---------|--------| -| count | 展示的数字,大于 99 时显示为 99+,为 0 时隐藏 | Number | | | +| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | Number | | | +| overflowCount | 展示封顶的数字值 | Number | | 99 | | dot | 不展示数字,只有一个小红点 | boolean | | false |