From ec93edcc60c7ca49d8caf2efb6f7ce020e2be156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 10 Aug 2018 15:03:51 +0800 Subject: [PATCH] Increase the judgment of pathname --- src/components/PageHeader/index.js | 8 ++++++-- src/pages/layouts/PageHeaderLayout.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index ec12b891..a8cfca28 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -35,8 +35,12 @@ export default class PageHeader extends PureComponent { } componentDidUpdate(preProps) { - const { tabActiveKey } = this.props; - if (preProps.tabActiveKey !== tabActiveKey) { + const { + tabActiveKey, + location: { pathname }, + } = this.props; + const prePathname = preProps.location.pathname; + if (preProps.tabActiveKey !== tabActiveKey || prePathname !== pathname) { this.getBreadcrumbDom(); } } diff --git a/src/pages/layouts/PageHeaderLayout.js b/src/pages/layouts/PageHeaderLayout.js index 07a8825d..8263b18a 100644 --- a/src/pages/layouts/PageHeaderLayout.js +++ b/src/pages/layouts/PageHeaderLayout.js @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'umi/locale'; import { Link } from 'dva/router'; -import PageHeader from '../../components/PageHeader'; +import PageHeader from 'components/PageHeader'; import GridContent from './GridContent'; import styles from './PageHeaderLayout.less'; import MenuContext from './MenuContext'; -- GitLab