perf(admin): 实现切页即时导航与列表 loading 壳
非阻塞 session 刷新、侧边栏 chunk 预取、KeepAlive 对齐,以及按 tab 延迟加载重型列表页。
This commit is contained in:
@@ -129,8 +129,8 @@ function tableSummary(param: {
|
||||
});
|
||||
}
|
||||
|
||||
async function loadHistory() {
|
||||
historyLoading.value = true;
|
||||
async function loadHistory(opts?: { silent?: boolean }) {
|
||||
if (!opts?.silent) historyLoading.value = true;
|
||||
try {
|
||||
const { data } = await api.get('/admin/cashbacks', {
|
||||
params: {
|
||||
@@ -144,7 +144,7 @@ async function loadHistory() {
|
||||
} catch (err) {
|
||||
ElMessage.error(resolveApiError(err, t, 'msg.load_failed'));
|
||||
} finally {
|
||||
historyLoading.value = false;
|
||||
if (!opts?.silent) historyLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,9 +250,10 @@ function onHistoryStatusChange() {
|
||||
loadHistory();
|
||||
}
|
||||
|
||||
onMounted(loadHistory);
|
||||
// KeepAlive 激活时静默刷新
|
||||
onActivated(() => { if (history.value.length > 0) void loadHistory(); });
|
||||
onMounted(() => void loadHistory());
|
||||
onActivated(() => {
|
||||
if (history.value.length > 0) void loadHistory({ silent: true });
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user