From 7176b4ac74fae1ace1b93f52e018a48813d50b0b Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 25 Apr 2018 23:32:32 +0800 Subject: [PATCH] fix #1324 Step-Form breadcrumbs path problem --- src/components/PageHeader/index.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index a36fa7f1..993bd57e 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -26,6 +26,18 @@ export default class PageHeader extends PureComponent { location: PropTypes.object, breadcrumbNameMap: PropTypes.object, }; + + state = { + breadcrumb: null, + }; + + componentDidMount() { + this.getBreadcrumbDom(); + } + componentWillReceiveProps() { + this.getBreadcrumbDom(); + } + onChange = key => { if (this.props.onTabChange) { this.props.onTabChange(key); @@ -39,6 +51,12 @@ export default class PageHeader extends PureComponent { breadcrumbNameMap: this.props.breadcrumbNameMap || this.context.breadcrumbNameMap, }; }; + getBreadcrumbDom = () => { + const breadcrumb = this.conversionBreadcrumbList(); + this.setState({ + breadcrumb, + }); + }; // Generated according to props conversionFromProps = () => { const { breadcrumbList, breadcrumbSeparator, linkElement = 'a' } = this.props; @@ -158,8 +176,8 @@ export default class PageHeader extends PureComponent { tabDefaultActiveKey, tabBarExtraContent, } = this.props; + const clsString = classNames(styles.pageHeader, className); - const breadcrumb = this.conversionBreadcrumbList(); const activeKeyProps = {}; if (tabDefaultActiveKey !== undefined) { activeKeyProps.defaultActiveKey = tabDefaultActiveKey; @@ -170,7 +188,7 @@ export default class PageHeader extends PureComponent { return (
- {breadcrumb} + {this.state.breadcrumb}
{logo &&
{logo}
}
-- GitLab