Explorar o código

Increase the judgment of pathname

陈帅 %!s(int64=7) %!d(string=hai) anos
pai
achega
ec93edcc60

+ 6 - 2
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();
     }
   }

+ 1 - 1
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';