Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types(keepalive): 修复customTabs时会丢失TabConfig类型的问题 #658

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/plugins/src/keepalive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function closeAllTabs() {
noPluginDir: true,
path: `${DIR_NAME}/index.tsx`,
content: `
export { KeepAliveContext,useKeepOutlets } from './context';
export { KeepAliveContext, type KeepAliveContextProps, useKeepOutlets } from './context';
export { dropByCacheKey, closeTab, closeAllTabs } from './support';
`,
});
Expand Down
11 changes: 6 additions & 5 deletions packages/plugins/templates/keepalive/context.tpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// tpl 语法非常乱,修改这个文件,请仔细仔细再仔细的验证之后再提交代码
import React, { ReactNode, useEffect } from 'react';
import { useOutlet, useLocation, matchPath, useNavigate } from 'react-router-dom'
{{^hasCustomTabs}}
{{#hasTabsLayout}}
import { Tabs, message, Dropdown, Button, Menu, TabPaneProps } from "antd";
import type { TabPaneProps } from "antd";
{{^hasCustomTabs}}
import { Tabs, message, Dropdown, Button, Menu } from "antd";
import { EllipsisOutlined, VerticalRightOutlined, VerticalLeftOutlined, CloseOutlined, ReloadOutlined } from "@ant-design/icons";
{{/hasTabsLayout}}
{{/hasCustomTabs}}
{{/hasTabsLayout}}
{{#hasTabsLayout}}
import { getPluginManager } from '../core/plugin';
{{/hasTabsLayout}}
Expand All @@ -20,11 +21,12 @@ import { useAppData } from '../exports';
{{#hasIntl}}
import { useIntl } from '../exports';
{{/hasIntl}}
{{^hasCustomTabs}}
{{#hasTabsLayout}}
{{^hasCustomTabs}}
{{^isNewTabsAPISupported}}
const { TabPane } = Tabs;
{{/isNewTabsAPISupported}}
{{/hasCustomTabs}}

export interface TabConfig extends TabPaneProps{
icon?: ReactNode;
Expand All @@ -33,7 +35,6 @@ export interface TabConfig extends TabPaneProps{
}

{{/hasTabsLayout}}
{{/hasCustomTabs}}


export interface KeepAliveContextProps {
Expand Down
Loading