mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-09 13:53:38 +08:00
@@ -1,17 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, unref, computed, getCurrentInstance } from "vue";
|
||||
import { useSettingStoreHook } from "/@/store/modules/settings";
|
||||
import { ref, getCurrentInstance } from "vue";
|
||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||
|
||||
const keepAlive: Boolean = ref(
|
||||
getCurrentInstance().appContext.config.globalProperties.$config?.KeepAlive
|
||||
);
|
||||
|
||||
const getCachedPageList = computed((): string[] => {
|
||||
if (!unref(keepAlive)) {
|
||||
return [];
|
||||
}
|
||||
return useSettingStoreHook().cachedPageList;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -19,7 +12,10 @@ const getCachedPageList = computed((): string[] => {
|
||||
<router-view>
|
||||
<template #default="{ Component, route }">
|
||||
<transition appear name="fade-transform" mode="out-in">
|
||||
<keep-alive v-if="keepAlive" :include="getCachedPageList">
|
||||
<keep-alive
|
||||
v-if="keepAlive"
|
||||
:include="usePermissionStoreHook().cachePageList"
|
||||
>
|
||||
<component :is="Component" :key="route.fullPath" />
|
||||
</keep-alive>
|
||||
<component v-else :is="Component" :key="route.fullPath" />
|
||||
|
||||
Reference in New Issue
Block a user