perf(admin): 实现切页即时导航与列表 loading 壳
非阻塞 session 刷新、侧边栏 chunk 预取、KeepAlive 对齐,以及按 tab 延迟加载重型列表页。
This commit is contained in:
@@ -77,8 +77,8 @@ const auditTarget = ref<DepositOrderRow | null>(null);
|
||||
const auditLogs = ref<DepositAuditLogRow[]>([]);
|
||||
const auditLoading = ref(false);
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true;
|
||||
async function fetchList(opts?: { silent?: boolean }) {
|
||||
if (!opts?.silent) loading.value = true;
|
||||
try {
|
||||
const params: any = { page: page.value, pageSize: pageSize.value };
|
||||
if (statusFilter.value) params.status = statusFilter.value;
|
||||
@@ -90,7 +90,7 @@ async function fetchList() {
|
||||
total.value = result.total ?? 0;
|
||||
void refreshDepositPendingCount();
|
||||
} catch { /* */ } finally {
|
||||
loading.value = false;
|
||||
if (!opts?.silent) loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,13 +249,14 @@ function refreshList() {
|
||||
function prevPage() { if (page.value > 1) { page.value--; fetchList(); } }
|
||||
function nextPage() { if (page.value * pageSize.value < total.value) { page.value++; fetchList(); } }
|
||||
|
||||
onMounted(fetchList);
|
||||
// KeepAlive 激活时静默刷新
|
||||
onActivated(() => { if (items.value.length > 0) void fetchList(); });
|
||||
onMounted(() => void fetchList());
|
||||
onActivated(() => {
|
||||
if (items.value.length > 0) void fetchList({ silent: true });
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-deposit-orders">
|
||||
<div v-loading="loading" class="page-deposit-orders">
|
||||
<div class="toolbar">
|
||||
<h2>{{ t('deposit.deposit_orders_title') }}</h2>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user