mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2026-11-26 22:33:34 +08:00
Add layout presets, menu controls, a watermark preview, and workspace actions. Refine tab spacing and user management. Fix cached route transition sequencing.
51 lines
1.4 KiB
Vue
51 lines
1.4 KiB
Vue
<template>
|
||
<div class="r-route-transition">
|
||
<RouterView v-slot="{ Component, route }">
|
||
<template v-if="Component">
|
||
<Transition
|
||
:name="transitionPropName"
|
||
:mode="transitionMode"
|
||
:appear="transitionAppear"
|
||
>
|
||
<!-- KeepAlive 必须在 Suspense 外,避免过渡将缓存容器视为同一页面并提前结束退出。 -->
|
||
<KeepAlive
|
||
v-if="getKeepAliveConfig.setupKeepAlive"
|
||
:max="getKeepAliveConfig.maxKeepAliveLength"
|
||
:include="getKeepAliveInclude"
|
||
:exclude="getKeepAliveConfig.keepAliveExclude"
|
||
>
|
||
<Suspense>
|
||
<Component :is="Component" :key="route.fullPath" />
|
||
</Suspense>
|
||
</KeepAlive>
|
||
<Suspense v-else>
|
||
<Component :is="Component" :key="route.fullPath" />
|
||
</Suspense>
|
||
</Transition>
|
||
</template>
|
||
</RouterView>
|
||
</div>
|
||
</template>
|
||
<script lang="ts" setup>
|
||
import { RouterView } from 'vue-router'
|
||
import defaults from './transition-defaults'
|
||
import type { TransitionProps } from './transition-types'
|
||
|
||
defineOptions({
|
||
name: 'RTransitionComponent',
|
||
})
|
||
withDefaults(
|
||
defineProps<
|
||
TransitionProps & {
|
||
getKeepAliveConfig: {
|
||
setupKeepAlive: boolean
|
||
maxKeepAliveLength: number
|
||
keepAliveExclude: string[]
|
||
}
|
||
getKeepAliveInclude: string[]
|
||
}
|
||
>(),
|
||
defaults,
|
||
)
|
||
</script>
|