UNPKG

@daysnap/vue-use

Version:
28 lines (27 loc) 924 B
export interface UseKeepAliveState { /** * Route name 和 Component name 要保证一致,不然缓存会失败 */ name: string; /** * vue-router history.state.position * https://router.vuejs.org/zh/api/interfaces/RouterHistory.html#Properties-state */ position: number; /** * 模式,如果是 auto 则自动会管理,如果设置的是 custom 则需要手动管理 */ mode: 'auto' | 'custom'; /** * 关联的路由 如果是一个路由有子路由 则需要关联下子路由name */ relations?: string[]; } export type UseKeepAliveOptions = Partial<Omit<UseKeepAliveState, 'position'>> | number; /** * 结合 KeepAlive 组件,维护其 includes */ export declare function useKeepAlive(options?: UseKeepAliveOptions): { keepAliveList: import("vue").Ref<UseKeepAliveState[] | undefined>; includes: import("vue").Ref<string[]>; };