perf(admin): 实现切页即时导航与列表 loading 壳
非阻塞 session 刷新、侧边栏 chunk 预取、KeepAlive 对齐,以及按 tab 延迟加载重型列表页。
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onActivated, onBeforeUnmount } from 'vue';
|
||||
import { ref, onBeforeUnmount } from 'vue';
|
||||
|
||||
defineOptions({ name: 'AdminMatchesOutrights' });
|
||||
import { useStaleListLifecycle } from '../composables/useStaleList';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useAdminLocale } from '../composables/useAdminLocale';
|
||||
import api from '../api';
|
||||
@@ -95,12 +96,12 @@ async function resolveExpandFromQuery() {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
async function initialLoad() {
|
||||
await load({ restoreExpand: true });
|
||||
await resolveExpandFromQuery();
|
||||
});
|
||||
// KeepAlive 激活时静默刷新
|
||||
onActivated(() => { if (leagues.value.length > 0) void load({ keepExpand: true }); });
|
||||
}
|
||||
|
||||
const { loading: listLoading, runLoad } = useStaleListLifecycle(() => leagues.value.length > 0, initialLoad);
|
||||
onBeforeUnmount(persistListUiState);
|
||||
|
||||
function onPageChange(p: number) {
|
||||
@@ -177,7 +178,7 @@ function isLeagueExpanded(id: string) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="list-panel">
|
||||
<section v-loading="listLoading" class="list-panel">
|
||||
<p class="list-hint">{{ t('match.expand_outright_hint') }}</p>
|
||||
<div class="table-wrap">
|
||||
<el-table
|
||||
|
||||
Reference in New Issue
Block a user