diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js
index 5fbe3648b995312470fcf1c38696578564044f61..7bb8b4e38f8c8b5fd58c473b5c8296d824b48366 100644
--- a/src/components/PageHeader/index.js
+++ b/src/components/PageHeader/index.js
@@ -59,9 +59,8 @@ export default class PageHeader extends PureComponent {
const url = `/${pathSnippets.slice(0, index + 1).join('/')}`;
return (
- {createElement(linkElement, {
- to: url,
- href: url,
+ {createElement(index === pathSnippets.length - 1 ? 'span' : linkElement, {
+ [linkElement === 'a' ? 'href' : 'to']: url,
}, breadcrumbNameMap[url] || breadcrumbNameMap[url.replace('/', '')] || url)}
);
@@ -69,8 +68,7 @@ export default class PageHeader extends PureComponent {
const breadcrumbItems = [(
{createElement(linkElement, {
- to: '/',
- href: '/',
+ [linkElement === 'a' ? 'href' : 'to']: '/',
}, '首页')}
)].concat(extraBreadcrumbItems);
@@ -85,7 +83,11 @@ export default class PageHeader extends PureComponent {
{
breadcrumbList.map(item => (
- {item.href ? {item.title} : item.title}
+ {item.href ? (
+ createElement(linkElement, {
+ [linkElement === 'a' ? 'href' : 'to']: item.href,
+ }, '首页')
+ ) : item.title}
)
)
}