vue3-tabor
Version:
Vue 3 routing tabs with keepAlive support, browser-like tab navigation for Vue applications
42 lines (40 loc) • 1.51 kB
TypeScript
import { VNode } from 'vue';
declare class VNodeWrapper {
vnode: VNode;
lastAccessed: number;
constructor(vnode: VNode, lastAccessed: number);
}
interface CacheOptions {
max?: number;
}
export declare const useCache: (options: CacheOptions) => {
state: {
keySet: Set<string> & Omit<Set<string>, keyof Set<any>>;
keyToWrapper: Map<string, {
vnode: VNode;
lastAccessed: number;
}> & Omit<Map<string, VNodeWrapper>, keyof Map<any, any>>;
componentMap: WeakMap<VNodeWrapper, VNode<import('vue').RendererNode, import('vue').RendererElement, {
[key: string]: any;
}>> & Omit<WeakMap<VNodeWrapper, VNode<import('vue').RendererNode, import('vue').RendererElement, {
[key: string]: any;
}>>, keyof WeakMap<any, any>>;
refreshing: boolean;
activeKey: string | undefined;
};
keys: import('vue').ComputedRef<string[]>;
setActiveKey: (key: string | undefined) => void;
add: (key: string) => void;
has: (key: string) => boolean;
hasComponent: (key: string) => boolean;
getComponent: (key: string) => VNode<import('vue').RendererNode, import('vue').RendererElement, {
[key: string]: any;
}> | undefined;
addComponent: (key: string, vNode: VNode) => void;
remove: (key: string) => void;
reset: () => void;
refresh: (key: string) => Promise<void>;
cleanup: () => void;
};
export type Cache = ReturnType<typeof useCache>;
export {};