Browse Source

fix:close other tabs

dev
powersir 1 year ago
parent
commit
7ef5f99f82
2 changed files with 2 additions and 2 deletions
  1. +1
    -0
      src/hooks/use-tabs/index.tsx
  2. +1
    -2
      src/layout/tabs-layout.tsx

+ 1
- 0
src/hooks/use-tabs/index.tsx View File

@@ -46,6 +46,7 @@ export function useTabs() {
// 关闭除了自己其它tab
const closeOtherTab = useCallback((routePath: string = activeTabRoutePath) => {
setKeepAliveTabs(prev => prev.filter(o => o.routePath === routePath));
router.navigate(routePath);
}, [activeTabRoutePath]);

// 刷新tab


+ 1
- 2
src/layout/tabs-layout.tsx View File

@@ -38,7 +38,6 @@ const TabsLayout: React.FC = () => {
].filter(o => o !== null) as MenuItemType[],
[tabs]
);

const menuClick = useCallback(({ key, domEvent }: any, tab: KeepAliveTab) => {
domEvent.stopPropagation();

@@ -55,7 +54,7 @@ const TabsLayout: React.FC = () => {
return (
<Dropdown
menu={{ items: menuItems, onClick: (e) => menuClick(e, tab) }}
trigger={['contextMenu']}
trigger={['hover']}
>
<div style={{ margin: '-12px 0', padding: '12px 0' }}>
{getIcon(tab.icon)}


Loading…
Cancel
Save