update breadcrumb demo

pull/29/head
afc163 10 years ago
parent c876a71a54
commit ced4dcb991

@ -2,7 +2,7 @@
- order: 0
最简单的用法。
最简单的用法,存在 `href` 表示可点
---
@ -11,9 +11,10 @@ var Breadcrumb = antd.Breadcrumb;
React.render(
<Breadcrumb>
<Breadcrumb.Item href="">首页</Breadcrumb.Item>
<Breadcrumb.Item>首页</Breadcrumb.Item>
<Breadcrumb.Item href="">应用中心</Breadcrumb.Item>
<Breadcrumb.Item href="">应用列表</Breadcrumb.Item>
<Breadcrumb.Item>应用</Breadcrumb.Item>
<Breadcrumb.Item>应用</Breadcrumb.Item>
</Breadcrumb>
, document.getElementById('components-breadcrumb-demo-basic'));
````

@ -0,0 +1,27 @@
# 带有图标的
- order: 1
图标放在文字前面。
---
````jsx
var Breadcrumb = antd.Breadcrumb;
React.render(
<Breadcrumb>
<Breadcrumb.Item href="">
<i className="anticon anticon-user"></i>
</Breadcrumb.Item>
<Breadcrumb.Item href="">
<i className="anticon anticon-folder-open"></i>
应用列表
</Breadcrumb.Item>
<Breadcrumb.Item>
应用
</Breadcrumb.Item>
</Breadcrumb>
, document.getElementById('components-breadcrumb-demo-withicon'));
````

@ -9,20 +9,21 @@ let BreadcrumbItem = React.createClass({
var link = <a className={prefixCls + '-link'} {...this.props}>{this.props.children}</a>;
var slash = <span className={prefixCls + '-slash'}>/</span>;
if (typeof this.props.href === 'undefined') {
slash = '';
link = <span className={prefixCls + '-link'} {...this.props}>{this.props.children}</span>;
}
return (
<span>
{link}
{slash}
</span>
);
if (this.props.last) {
slash = '';
}
return <span>{link} {slash}</span>;
}
});
let Breadcrumb = React.createClass({
render() {
if (this.props.children.length > 0) {
var last = this.props.children[this.props.children.length - 1];
last.props.last = true;
}
return (
<div className={prefixCls}>
{this.props.children}

@ -17,4 +17,14 @@
margin: 0 8px;
color: #d9d9d9;
}
.anticon {
font-size: 14px;
position: relative;
top: -1px;
}
.anticon + span {
margin-left: 6px;
}
}

@ -6,10 +6,6 @@
text-align: center;
text-transform: none;
text-rendering: auto;
// 更好地渲染字体
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0px;
-moz-osx-font-smoothing: grayscale;
&:before {
display: block;

Loading…
Cancel
Save