({
isKeep,
keepElements,
navigate,
dropByCacheKey,
dropLeftTabs,
dropRightTabs,
dropOtherTabs,
refreshTab,
activeKey,
})
| 30 | }; |
| 31 | |
| 32 | const TabsLayout: FC<TabsLayoutProps> = ({ |
| 33 | isKeep, |
| 34 | keepElements, |
| 35 | navigate, |
| 36 | dropByCacheKey, |
| 37 | dropLeftTabs, |
| 38 | dropRightTabs, |
| 39 | dropOtherTabs, |
| 40 | refreshTab, |
| 41 | activeKey, |
| 42 | }) => { |
| 43 | const prefix = 'components.TabsLayout.'; |
| 44 | // 国际化工具 |
| 45 | const { formatMessage } = useIntl(); |
| 46 | // hooks 调用 |
| 47 | const { message } = App.useApp(); |
| 48 | /** |
| 49 | * @description: 点击菜单回调 |
| 50 | */ |
| 51 | const handleClickMenu = useCallback( |
| 52 | (key: string) => { |
| 53 | const pathName = location.pathname?.toLowerCase(); |
| 54 | switch (key) { |
| 55 | case TABSLAYOUT.REFRESH: |
| 56 | refreshTab(pathName); |
| 57 | break; |
| 58 | case TABSLAYOUT.RIGHT: |
| 59 | dropRightTabs(pathName); |
| 60 | break; |
| 61 | case TABSLAYOUT.LEFT: |
| 62 | dropLeftTabs(pathName); |
| 63 | break; |
| 64 | case TABSLAYOUT.OTHERS: |
| 65 | dropOtherTabs(pathName); |
| 66 | break; |
| 67 | } |
| 68 | }, |
| 69 | [dropLeftTabs, dropOtherTabs, dropRightTabs, refreshTab], |
| 70 | ); |
| 71 | /** |
| 72 | * @description: 右键菜单配置项 |
| 73 | */ |
| 74 | const renderMenuItem = (key: EnumValues<typeof TABSLAYOUT>, icon: UmiIcon) => ({ |
| 75 | label: formatMessage({ id: `${prefix}${key}` }), |
| 76 | icon: <Icon icon={icon} style={{ fontSize: 16, display: 'flex' }} />, |
| 77 | key: key, |
| 78 | }); |
| 79 | const menuItems: MenuProps['items'] = [ |
| 80 | // 重新加载 |
| 81 | renderMenuItem(TABSLAYOUT.REFRESH, 'ri:refresh-line'), |
| 82 | { type: 'divider' }, |
| 83 | // 关闭右侧 |
| 84 | renderMenuItem(TABSLAYOUT.RIGHT, 'ri:skip-right-line'), |
| 85 | // 关闭左侧 |
| 86 | renderMenuItem(TABSLAYOUT.LEFT, 'ri:skip-left-line'), |
| 87 | { type: 'divider' }, |
| 88 | // 关闭其它 |
| 89 | renderMenuItem(TABSLAYOUT.OTHERS, 'ri:arrow-left-right-line'), |
nothing calls this directly
no test coverage detected