修改页面缓存

This commit is contained in:
GGJ
2025-01-15 08:42:41 +08:00
parent cb4e4646bd
commit b8e502b168
2 changed files with 17 additions and 13 deletions

View File

@@ -5,7 +5,7 @@
:size='assemblySize' :size='assemblySize'
:button='buttonConfig' :button='buttonConfig'
> >
<router-view :key='$route.fullPath' /> <router-view />
</el-config-provider> </el-config-provider>
</template> </template>

View File

@@ -2,21 +2,15 @@
<Maximize v-show="maximize" /> <Maximize v-show="maximize" />
<Tabs v-if="tabs && showMenuFlag" /> <Tabs v-if="tabs && showMenuFlag" />
<el-main> <el-main>
<!-- style="height: calc(100vh - 157px);overflow-y:auto; overflow-x:hidden;" :style='{height:showMenuFlag?"calc(100vh - 157px)":" calc(100vh - 120px)"}' -->
<router-view v-slot="{ Component, route }" style="height:100%;"> <router-view v-slot="{ Component, route }" style="height:100%;">
<transition appear name="fade-transform" mode="out-in"> <!-- <transition name="slide-right" mode="out-in"> -->
<keep-alive :include="keepAliveName"> <keep-alive :include="keepAliveName" >
<component <component :is="Component" :key="route.fullPath" />
:is="Component"
v-if="isRouterShow"
:key="route.fullPath"
/>
</keep-alive> </keep-alive>
</transition> <!-- </transition> -->
</router-view> </router-view>
</el-main> </el-main>
<el-footer > <el-footer>
<!-- v-show="footer" -->
<Footer /> <Footer />
</el-footer> </el-footer>
</template> </template>
@@ -31,12 +25,14 @@ import Maximize from "./components/Maximize.vue";
import Tabs from "@/layouts/components/Tabs/index.vue"; import Tabs from "@/layouts/components/Tabs/index.vue";
import Footer from "@/layouts/components/Footer/index.vue"; import Footer from "@/layouts/components/Footer/index.vue";
import { useAuthStore } from "@/stores/modules/auth"; import { useAuthStore } from "@/stores/modules/auth";
import { useRoute, type RouteLocationNormalized } from 'vue-router'
const globalStore = useGlobalStore(); const globalStore = useGlobalStore();
const authStore = useAuthStore(); const authStore = useAuthStore();
const { maximize, isCollapse, layout, tabs, footer } = storeToRefs(globalStore); const { maximize, isCollapse, layout, tabs, footer } = storeToRefs(globalStore);
const route = useRoute()
const keepAliveStore = useKeepAliveStore(); const keepAliveStore = useKeepAliveStore();
const { keepAliveName } = storeToRefs(keepAliveStore); const { keepAliveName } = storeToRefs(keepAliveStore);
// console.log("🚀 ~ keepAliveName:", keepAliveName)
//是否显示导航栏 //是否显示导航栏
const showMenuFlag = computed(() => authStore.showMenuFlagGet); const showMenuFlag = computed(() => authStore.showMenuFlagGet);
// 注入刷新页面方法 // 注入刷新页面方法
@@ -64,6 +60,14 @@ watch(
}, },
{ immediate: true } { immediate: true }
); );
watch(
() => route.path,
() => {
console.log(123, route.path);
},
);
// 监听窗口大小变化,折叠侧边栏 // 监听窗口大小变化,折叠侧边栏
const screenWidth = ref(0); const screenWidth = ref(0);