Skip to content

Commit

Permalink
feat: hideTab feature
Browse files Browse the repository at this point in the history
  • Loading branch information
d3george committed Mar 24, 2024
1 parent e76fe42 commit ce29e6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/_mock/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ const OTHERS_PERMISSION = [
type: PermissionType.MENU,
route: 'blank',
component: '/sys/others/blank.tsx',
hideTab: true,
},
];

Expand Down
1 change: 1 addition & 0 deletions src/layouts/dashboard/multi-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export default function MultiTabs({ offsetTop = false }: Props) {
*/
const renderTabLabel = useCallback(
(tab: KeepAliveTab) => {
if (tab.hideTab) return null;
return (
<Dropdown
trigger={['contextMenu']}
Expand Down
6 changes: 2 additions & 4 deletions src/router/hooks/use-match-route-meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ export function useMatchRouteMeta() {
(item) => item.key === lastRoute?.pathname || `${item.key}/` === lastRoute?.pathname,
);
if (currentRouteMeta) {
if (!currentRouteMeta.hideTab) {
currentRouteMeta.outlet = children;
setMatchRouteMeta(currentRouteMeta);
}
currentRouteMeta.outlet = children;
setMatchRouteMeta(currentRouteMeta);
} else {
push(HOMEPAGE);
}
Expand Down

0 comments on commit ce29e6d

Please sign in to comment.