修改tab刷新位置问题

This commit is contained in:
GGJ
2025-01-15 09:07:12 +08:00
parent 0cace11975
commit 0e41a5b9f1
4 changed files with 14 additions and 11 deletions

View File

@@ -4,7 +4,7 @@
<el-main>
<router-view v-slot="{ Component, route }" style="height:100%;">
<!-- <transition name="slide-right" mode="out-in"> -->
<keep-alive :include="keepAliveName" >
<keep-alive :include="tabsMenuList" >
<component :is="Component" :key="route.fullPath" />
</keep-alive>
<!-- </transition> -->
@@ -25,11 +25,12 @@ import Maximize from "./components/Maximize.vue";
import Tabs from "@/layouts/components/Tabs/index.vue";
import Footer from "@/layouts/components/Footer/index.vue";
import { useAuthStore } from "@/stores/modules/auth";
import { useRoute, type RouteLocationNormalized } from 'vue-router'
import { useTabsStore } from '@/stores/modules/tabs'
const tabStore = useTabsStore()
const globalStore = useGlobalStore();
const tabsMenuList = computed(() => tabStore.tabsMenuList.map(item => item.name))
const authStore = useAuthStore();
const { maximize, isCollapse, layout, tabs, footer } = storeToRefs(globalStore);
const route = useRoute()
const keepAliveStore = useKeepAliveStore();
const { keepAliveName } = storeToRefs(keepAliveStore);
// console.log("🚀 ~ keepAliveName:", keepAliveName)
@@ -60,14 +61,7 @@ watch(
},
{ immediate: true }
);
watch(
() => route.path,
() => {
console.log(123, route.path);
},
);
// 监听窗口大小变化,折叠侧边栏
const screenWidth = ref(0);