feat(short-drama-agent-front): 新增路由淡入淡出过渡

This commit is contained in:
GJ committed 2026-11-08 18:15:24 +08:00
1 parent 8674ba0c83
commit c7a6b12261
3 files changed
+39 -2

No files matched your search

+10 -1
View File
@@ -310,7 +310,16 @@ const menuOptions = computed<MenuOption[]>(() => {
:compact="narrow" :compact="narrow"
/> />
</NLayoutHeader> </NLayoutHeader>
<main id="main-content" tabindex="-1" class="admin-content"><RouterView /></main> <!-- 以下是主路由淡入淡出模块,项目内导航保留共享布局与任务状态。 -->
<main id="main-content" tabindex="-1" class="admin-content">
<RouterView v-slot="{ Component, route: viewRoute }">
<Transition name="route-fade" mode="out-in">
<div :key="viewRoute.matched[0]?.path" class="route-view">
<component :is="Component" />
</div>
</Transition>
</RouterView>
</main>
</NLayout> </NLayout>
</div> </div>
<AppDialog v-model:open="settingsOpen" title="连接设置"> <AppDialog v-model:open="settingsOpen" title="连接设置">
+12 -1
View File
@@ -411,7 +411,18 @@ onScopeDispose(() => {
@quality-saved="context.refresh()" @quality-saved="context.refresh()"
/> />
<div class="project-view"> <div class="project-view">
<RouterView v-if="context.project.value?.id === id && currentAccess?.enabled" :key="id" /> <!-- 以下是工作区路由淡入淡出模块,筛选和定位参数变化时保留当前页面。 -->
<RouterView
v-if="context.project.value?.id === id && currentAccess?.enabled"
:key="id"
v-slot="{ Component, route: viewRoute }"
>
<Transition name="route-fade" mode="out-in">
<div :key="viewRoute.path" class="route-view">
<component :is="Component" />
</div>
</Transition>
</RouterView>
<EmptyState <EmptyState
v-else-if="context.project.value?.id === id && !isProjectInitialLoading" v-else-if="context.project.value?.id === id && !isProjectInitialLoading"
class="project-access-gate" class="project-access-gate"
+17
View File
@@ -278,6 +278,23 @@
padding-inline: 14px; padding-inline: 14px;
} }
} }
/* 两层路由共用淡入淡出;固定内容高度,兼容多根节点页面和内部滚动。 */
.route-view {
height: 100%;
min-height: 0;
min-width: 0;
}
.route-fade-enter-active {
transition: opacity 160ms ease-out;
}
.route-fade-leave-active {
transition: opacity 120ms ease-in;
pointer-events: none;
}
.route-fade-enter-from,
.route-fade-leave-to {
opacity: 0;
}
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
*, *,
*::before, *::before,