/* eslint-disable @typescript-eslint/no-empty-function */ import { createContext } from 'react'; import { KeepAliveTab } from "../../hooks/use-tabs"; interface KeepAliveTabContextType { /** * 刷新tab * @param path tab path 可以为空,为空则刷新当前tab */ refreshTab: (path?: string) => void; /** * 关闭tab * @param path tab path 可以为空,为空则关闭当前tab */ closeTab: (path?: string) => void; /** * 关闭其他tab * @param path tab path 可以为空,为空则关闭其他tab */ closeOtherTab: (path?: string) => void; setTabs?: (tabs: KeepAliveTab[]) => void; // 设置tabs activeTabRoutePath?: string; // 当前tab tabs?: KeepAliveTab[]; // 打开的tab } const defaultValue = { refreshTab: () => { }, closeTab: () => { }, closeOtherTab: () => { }, setTabs: () => { }, activeTabRoutePath: "", tabs: [] } export const KeepAliveTabContext = createContext(defaultValue);