mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
move paths as linkRender argument (#2002)
This commit is contained in:
parent
4b05250a6b
commit
3264f6b956
@ -17,7 +17,7 @@ export default class Breadcrumb extends React.Component {
|
||||
static defaultProps = {
|
||||
prefixCls: 'ant-breadcrumb',
|
||||
separator: '/',
|
||||
linkRender: (paths, name) => <a href={`#/${paths.join('/')}`}>{name}</a>,
|
||||
linkRender: (href, name) => <a href={`#${href}`}>{name}</a>,
|
||||
nameRender: defaultNameRender,
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ export default class Breadcrumb extends React.Component {
|
||||
}
|
||||
const name = nameRender(route.breadcrumbName, route, params);
|
||||
if (name) {
|
||||
const link = (i === lastPath) ? name : linkRender(paths, name);
|
||||
const link = (i === lastPath) ? name : linkRender(`/${paths.join('/')}`, name, paths);
|
||||
return <BreadcrumbItem separator={separator} key={route.breadcrumbName || i}>{link}</BreadcrumbItem>;
|
||||
}
|
||||
return null;
|
||||
|
@ -29,5 +29,5 @@ english: Breadcrumb
|
||||
| routes | router 的路由栈信息 | Array | | - |
|
||||
| params | 路由的参数 | Object | | - |
|
||||
| separator | 分隔符自定义 | String or Element | | '/' |
|
||||
| linkRender | 自定义链接函数,和 react-router 配置使用 | Function(href, breadcrumbName) | | - |
|
||||
| linkRender | 自定义链接函数,和 react-router 配置使用 | Function(href, name, paths) | | - |
|
||||
| nameRender | 自定义文字函数,和 react-router 配置使用 | Function(breadcrumbName, route, params) | | - |
|
||||
|
Loading…
Reference in New Issue
Block a user