mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
hide badge when count is 0, fix #476
This commit is contained in:
parent
ee272e33bb
commit
27155b5d81
@ -10,10 +10,10 @@
|
||||
import { Badge } from 'antd';
|
||||
|
||||
ReactDOM.render(<div>
|
||||
<Badge count="99">
|
||||
<Badge count={99}>
|
||||
<a href="#" className="head-example"></a>
|
||||
</Badge>
|
||||
<Badge count="200">
|
||||
<Badge count={200}>
|
||||
<a href="#" className="head-example"></a>
|
||||
</Badge>
|
||||
</div>, document.getElementById('components-badge-demo-99plus'));
|
||||
|
@ -10,7 +10,7 @@
|
||||
import { Badge } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Badge count="5">
|
||||
<Badge count={5}>
|
||||
<a href="#" className="head-example"></a>
|
||||
</Badge>
|
||||
, document.getElementById('components-badge-demo-basic'));
|
||||
|
@ -11,7 +11,7 @@ import { Badge } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<a href="#">
|
||||
<Badge count="5">
|
||||
<Badge count={5}>
|
||||
<span className="head-example"></span>
|
||||
</Badge>
|
||||
</a>
|
||||
|
@ -14,7 +14,8 @@ class AntBadge extends React.Component {
|
||||
</span>;
|
||||
}
|
||||
let count = this.props.count;
|
||||
if (!count) {
|
||||
// null undefined "" "0" 0
|
||||
if (!count || count === '0') {
|
||||
return cloneElement(this.props.children);
|
||||
} else {
|
||||
count = count >= 100 ? '99+' : count;
|
||||
|
Loading…
Reference in New Issue
Block a user