20260819101952

This commit is contained in:
oneao committed 2026-08-19 10:19:56 +08:00
1 parent e91fd1d8de
commit 1ffc8e1ac9
14 files changed
+258 -886

No files matched your search

+22 -14
View File
@@ -111,20 +111,22 @@ function onSplitterResize(sizes) {
<div class="fms-content">
<router-view v-slot="{ Component }">
<transition name="page" mode="out-in">
<keep-alive :include="appStore.cachedViews" :max="8">
<component
:is="
getPageWrapper(
route.meta?.cacheByKey
? cacheKeyOf(route.fullPath)
: route.meta?.componentName,
route.fullPath,
Component,
)
"
:key="route.fullPath"
/>
</keep-alive>
<div :key="route.fullPath" class="fms-page-wrap">
<keep-alive :include="appStore.cachedViews" :max="8">
<component
:is="
getPageWrapper(
route.meta?.cacheByKey
? cacheKeyOf(route.fullPath)
: route.meta?.componentName,
route.fullPath,
Component,
)
"
:key="route.fullPath"
/>
</keep-alive>
</div>
</transition>
</router-view>
</div>
@@ -228,6 +230,12 @@ function onSplitterResize(sizes) {
padding: 12px 16px 16px;
}
/* 页面过渡外层包裹:稳定的 DOM 根,供 transition 的 out-in 模式直接管理,
* 避免 keep-alive 直接作 Transition 子节点时在 patch 阶段访问 null.parentNode 报错 */
.fms-page-wrap {
min-height: 100%;
}
/* ---- 页面过渡 ---- */
.page-enter-active {
transition:
@@ -151,11 +151,18 @@ function scrollTabs(direction) {
function revealActiveTab(behavior = 'smooth') {
const track = trackRef.value
if (!track) return
if (!track || !track.isConnected) return
const activeElement = Array.from(track.querySelectorAll('[data-tab-key]')).find(
(element) => element.dataset.tabKey === activeKey.value,
)
activeElement?.scrollIntoView({ behavior, block: 'nearest', inline: 'center' })
// 元素未挂载(路由过渡/布局重建时可能短暂脱离 DOM,parentNode 为 null)则跳过,
// 避免 scrollIntoView 抛出未捕获异常向上冒泡成 Promise 拒绝。
if (!activeElement || !activeElement.isConnected) return
try {
activeElement.scrollIntoView({ behavior, block: 'nearest', inline: 'center' })
} catch {
/* 元素正处于卸载/过渡中,忽略 */
}
}
function handleWheel(e) {
@@ -45,10 +45,10 @@ const user = computed(() => ({
account: authStore.user?.account ?? '',
}))
function logout() {
async function logout() {
authStore.clearSession()
Message.info('已退出登录')
router.replace('/login')
await router.replace('/login')
}
/* 用户下拉菜单:使用组件库标准 items 渲染(图标/危险色/分隔线/键盘导航均由库负责) */