Преглед на файлове

fix(layout): Not rendering the current Link repeatedly

close #7800
chenshuai2144 преди 5 години
родител
ревизия
d2abf996b6
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      src/layouts/BasicLayout.tsx

+ 1 - 1
src/layouts/BasicLayout.tsx

@@ -133,7 +133,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
       onCollapse={handleMenuCollapse}
       onCollapse={handleMenuCollapse}
       onMenuHeaderClick={() => history.push('/')}
       onMenuHeaderClick={() => history.push('/')}
       menuItemRender={(menuItemProps, defaultDom) => {
       menuItemRender={(menuItemProps, defaultDom) => {
-        if (menuItemProps.isUrl || !menuItemProps.path) {
+        if (menuItemProps.isUrl || !menuItemProps.path || pathname === menuItemProps.path) {
           return defaultDom;
           return defaultDom;
         }
         }
         return <Link to={menuItemProps.path}>{defaultDom}</Link>;
         return <Link to={menuItemProps.path}>{defaultDom}</Link>;