mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
breadcrumb
This commit is contained in:
parent
e551caddd5
commit
c42ca53d91
@ -27,13 +27,17 @@ let Breadcrumb = React.createClass({
|
||||
if (this.context.router) {
|
||||
routes = this.context.router.getCurrentRoutes();
|
||||
params = this.context.router.getCurrentParams();
|
||||
crumbs = routes.map(function(route) {
|
||||
crumbs = routes.map(function(route, i) {
|
||||
var name = route.name.replace(/\:(.*)/g, function(replacement, key) {
|
||||
return params[key] || replacement;
|
||||
});
|
||||
return <BreadcrumbItem>
|
||||
<Link to={route.path} params={params}>{name}</Link>
|
||||
</BreadcrumbItem>;
|
||||
var link;
|
||||
if (i === routes.length - 1) {
|
||||
link = <span>{name}</span>;
|
||||
} else {
|
||||
link = <Link to={route.path} params={params}>{name}</Link>;
|
||||
}
|
||||
return <BreadcrumbItem>{link}</BreadcrumbItem>;
|
||||
});
|
||||
} else {
|
||||
crumbs = this.props.children;
|
||||
|
@ -4,7 +4,7 @@
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
|
||||
a&-link {
|
||||
a {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user