import React from 'react'; let prefixCls = 'ant-breadcrumb'; let BreadcrumbItem = React.createClass({ render() { var link = {this.props.children}; var slash = /; if (typeof this.props.href === 'undefined') { link = {this.props.children}; } return {link}{slash}; } }); let Breadcrumb = React.createClass({ contextTypes: { router: React.PropTypes.object }, render() { let crumbs, routes, params; let ReactRouter = this.props.router; if (this.context.router && ReactRouter) { var Link = ReactRouter.Link; routes = this.context.router.state.branch; params = this.context.router.state.params; crumbs = routes.map(function(route, i) { var name = route.breadcrumbName.replace(/\:(.*)/g, function(replacement, key) { return params[key] || replacement; }); var link; if (i === routes.length - 1) { link = {name}; } else { link = {name}; } return {link}; }); } else { crumbs = this.props.children; } return (
{crumbs}
); } }); Breadcrumb.Item = BreadcrumbItem; export default Breadcrumb;