zb-admin/src/layout/components/Main/index.vue

40 lines
1.1 KiB
Vue
Raw Normal View History

2022-03-24 04:15:14 +00:00
<template>
2023-10-22 05:31:07 +00:00
<div class="app-main">
<router-view v-slot="{ Component, route }">
<transition name="fade-slide" mode="out-in" appear>
2023-12-22 09:46:27 +00:00
<keep-alive v-if="isReload" :include="cacheRoutes">
2023-10-22 05:31:07 +00:00
<component :is="useWrapComponents(Component, route)" :key="route.path" />
</keep-alive>
</transition>
</router-view>
2022-09-12 12:31:21 +00:00
</div>
2022-03-24 04:15:14 +00:00
</template>
2022-04-30 13:19:10 +00:00
<script lang="ts" setup>
2023-10-22 05:31:07 +00:00
import { useWrapComponents } from '@/hooks/useWrapComponents'
import { computed, ref } from 'vue'
2023-10-22 05:31:07 +00:00
import { useSettingStore } from '@/store/modules/setting'
import { usePermissionStore } from '@/store/modules/permission'
const SettingStore = useSettingStore()
const PermissionStore = usePermissionStore()
2023-10-22 05:31:07 +00:00
const cacheRoutes = computed(() => PermissionStore.keepAliveRoutes)
const isReload = computed(() => SettingStore.isReload)
2022-03-24 04:15:14 +00:00
</script>
<style lang="scss" scoped>
.app-main {
2022-09-12 12:31:21 +00:00
flex: 1;
2022-09-12 16:11:45 +00:00
display: flex;
2022-06-16 06:48:48 +00:00
overflow-x: hidden;
width: 100%;
2022-03-31 02:13:27 +00:00
box-sizing: border-box;
2023-10-22 05:31:07 +00:00
.app-main-inner {
2022-11-03 04:57:30 +00:00
flex: 1;
display: flex;
overflow-x: hidden;
width: 100%;
box-sizing: border-box;
}
2022-03-24 04:15:14 +00:00
}
</style>