feat(projects): 添加页面缓存、记录在tab中的缓存页面的滚动条位置

This commit is contained in:
Soybean
2022-01-21 23:59:14 +08:00
parent db3c25ea14
commit 1d63a83822
26 changed files with 343 additions and 160 deletions

View File

@ -3,16 +3,18 @@
:class="{ 'p-16px': showPadding }"
class="h-full bg-[#f6f9f8] dark:bg-[#101014] transition duration-300 ease-in-out"
>
<router-view v-slot="{ Component }">
<router-view v-slot="{ Component, route }">
<transition name="fade-slide" mode="out-in" appear>
<component :is="Component" v-if="app.reloadFlag" />
<keep-alive :include="routeStore.cacheRoutes">
<component :is="Component" v-if="app.reloadFlag" :key="route.path" />
</keep-alive>
</transition>
</router-view>
</div>
</template>
<script setup lang="ts">
import { useAppStore } from '@/store';
import { useAppStore, useRouteStore } from '@/store';
interface Props {
/** 显示padding */
@ -24,5 +26,6 @@ withDefaults(defineProps<Props>(), {
});
const app = useAppStore();
const routeStore = useRouteStore();
</script>
<style scoped></style>

View File

@ -33,13 +33,14 @@ interface Props {
const props = defineProps<Props>();
type LayoutConfig = {
[key in ThemeLayoutMode]: {
type LayoutConfig = Record<
ThemeLayoutMode,
{
placement: FollowerPlacement;
menuClass: string;
mainClass: string;
};
};
}
>;
const layoutConfig: LayoutConfig = {
vertical: {