perf(admin): 实现切页即时导航与列表 loading 壳

非阻塞 session 刷新、侧边栏 chunk 预取、KeepAlive 对齐,以及按 tab 延迟加载重型列表页。
This commit is contained in:
2026-06-18 16:45:01 +08:00
parent a832998b0a
commit e39798ae0a
21 changed files with 321 additions and 117 deletions

View File

@@ -1,7 +1,8 @@
<script setup lang="ts">
import { ref, computed, onMounted, onActivated, onBeforeUnmount } from 'vue';
import { ref, computed, onBeforeUnmount } from 'vue';
defineOptions({ name: 'AdminMatches' });
import { useStaleListLifecycle } from '../composables/useStaleList';
import { useRoute } from 'vue-router';
import { useAdminLocale } from '../composables/useAdminLocale';
import { resolveFormError } from '../i18n/form-validation';
@@ -110,21 +111,21 @@ async function load(options: LoadOptions = {}) {
function onSearch() {
page.value = 1;
expandedRowKeys.value = [];
load();
void runLoad(true);
}
onMounted(() => {
async function initialLoad() {
const qStatus = route.query.status;
if (typeof qStatus === 'string' && qStatus.trim()) {
filterStatus.value = qStatus.trim();
page.value = 1;
load();
await load();
return;
}
load({ restoreExpand: true });
});
// KeepAlive 激活时静默刷新,保持展开状态
onActivated(() => { if (leagues.value.length > 0) void load({ keepExpand: true }); });
await load({ restoreExpand: true });
}
const { loading: listLoading, runLoad } = useStaleListLifecycle(() => leagues.value.length > 0, initialLoad);
onBeforeUnmount(persistListUiState);
function onPageChange(p: number) {
@@ -421,7 +422,7 @@ function onLeagueArchived() {
<p v-if="filterStatus" class="list-hint">{{ t('match.filter.status_hint') }}</p>
</div>
<section class="list-panel">
<section v-loading="listLoading" class="list-panel">
<p class="list-hint">{{ t('match.expand_league_hint') }}</p>
<div class="table-wrap">
<el-table