提交 27155b5d 编写于 作者: A afc163

hide badge when count is 0, fix #476

上级 ee272e33
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册