51 lines
1.3 KiB
Vue
Raw Normal View History

<script lang="ts" setup>
2023-02-22 15:53:04 +08:00
import { useTagsViewStore } from "@/store/modules/tags-view"
2023-09-05 18:03:30 +08:00
import { useSettingsStore } from "@/store/modules/settings"
import Footer from "./Footer/index.vue"
2023-08-28 19:12:35 +08:00
2023-02-22 15:53:04 +08:00
const tagsViewStore = useTagsViewStore()
2023-09-05 18:03:30 +08:00
const settingsStore = useSettingsStore()
</script>
<template>
<section class="app-main">
2023-06-05 11:19:27 +08:00
<div class="app-scrollbar">
<!-- key 采用 route.path route.fullPath 有着不同的效果大多数时候 path 更通用 -->
<router-view v-slot="{ Component, route }">
2023-06-05 11:19:27 +08:00
<transition name="el-fade-in" mode="out-in">
<keep-alive :include="tagsViewStore.cachedViews">
2023-09-05 18:03:30 +08:00
<component :is="Component" :key="route.path" class="app-container-grow" />
2023-06-05 11:19:27 +08:00
</keep-alive>
</transition>
</router-view>
2023-09-05 18:03:30 +08:00
<!-- 页脚 -->
<Footer v-if="settingsStore.showFooter" />
2023-06-05 11:19:27 +08:00
</div>
2023-08-18 09:11:48 +08:00
<!-- 返回顶部 -->
<el-backtop />
<!-- 返回顶部固定 Header 情况下 -->
<el-backtop target=".app-scrollbar" />
</section>
</template>
<style lang="scss" scoped>
2023-06-05 11:19:27 +08:00
@import "@/styles/mixins.scss";
.app-main {
width: 100%;
background-color: var(--v3-body-bg-color);
display: flex;
}
2023-06-05 11:19:27 +08:00
.app-scrollbar {
flex-grow: 1;
2023-06-05 11:19:27 +08:00
overflow: auto;
@extend %scrollbar;
2023-09-05 18:03:30 +08:00
display: flex;
flex-direction: column;
.app-container-grow {
flex-grow: 1;
}
2023-06-05 11:19:27 +08:00
}
</style>