feat: ✨ (components)添加 KeepCache 组件用于统一处理页面缓存
This commit is contained in:
18
src/components/KeepCache/index.vue
Normal file
18
src/components/KeepCache/index.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<router-view>
|
||||
<template #default="{ Component, route }">
|
||||
<transition enter-active-class="animate__animated animate__fadeIn" mode="out-in">
|
||||
<keep-alive :include="tagsViewStore.cachedViews">
|
||||
<component :is="Component" :key="route.path" />
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</template>
|
||||
</router-view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
defineOptions({ name: "KeepCache" });
|
||||
|
||||
import { useTagsViewStore } from "@/store";
|
||||
|
||||
const tagsViewStore = useTagsViewStore();
|
||||
</script>
|
||||
Reference in New Issue
Block a user