mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2026-01-15 02:57:09 +08:00
first commit
This commit is contained in:
41
src/layout/components/Main.vue
Normal file
41
src/layout/components/Main.vue
Normal file
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<a-layout class="main">
|
||||
<router-view v-slot="{ Component, route }">
|
||||
<transition :name="transitionName(route)" mode="out-in" appear>
|
||||
<keep-alive :include="(tabsStore.cacheList as string[])">
|
||||
<component :is="Component" :key="route.matched?.[1]?.path" />
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</router-view>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
||||
import { useAppStore, useTabsStore } from '@/stores'
|
||||
|
||||
defineOptions({ name: 'Main' })
|
||||
const appStore = useAppStore()
|
||||
const tabsStore = useTabsStore()
|
||||
|
||||
// 过渡动画
|
||||
const transitionName = computed(() => {
|
||||
return function (route: RouteLocationNormalizedLoaded) {
|
||||
if (route?.matched?.[1]?.meta?.animation === false) {
|
||||
return ''
|
||||
}
|
||||
return appStore.transitionName
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.main {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user