diff --git a/components/breadcrumb/index.jsx b/components/breadcrumb/index.jsx index f9e0f8bd23..34982815f4 100644 --- a/components/breadcrumb/index.jsx +++ b/components/breadcrumb/index.jsx @@ -35,6 +35,7 @@ const Breadcrumb = React.createClass({ return { prefixCls: 'ant-breadcrumb', separator: '/', + linkRender: (href, name) => {name}, }; }, propTypes: { @@ -48,7 +49,7 @@ const Breadcrumb = React.createClass({ }, render() { let crumbs; - const { separator, prefixCls, routes, params, children } = this.props; + const { separator, prefixCls, routes, params, children, linkRender } = this.props; if (routes && routes.length > 0) { const paths = []; crumbs = routes.map((route, i) => { @@ -71,7 +72,7 @@ const Breadcrumb = React.createClass({ if (i === routes.length - 1) { link = {name}; } else { - link = {name}; + link = linkRender(`/${paths.join('/')}`, name); } return {link}; }); diff --git a/components/breadcrumb/index.md b/components/breadcrumb/index.md index 34685f895b..116cc4351b 100644 --- a/components/breadcrumb/index.md +++ b/components/breadcrumb/index.md @@ -11,7 +11,7 @@ ## 何时使用 - 当系统拥有超过两级以上的层级结构时; -- 当需要告知用户“你在哪里”时; +- 当需要告知用户『你在哪里』时; - 当需要向上导航的功能时。 ## API @@ -32,6 +32,7 @@ | routes | router 的路由栈信息 | Array | | - | | params | 路由的参数 | Object | | - | | separator | 分隔符自定义 | String or Element | | '/' | +| linkRender | 自定义链接函数,和 react-router 配置使用 | Function(href, name) | | - | ### Breadcrumb.Item