refactor: standardize keep-alive data refreshing using useKeepAliveRefresh composable across views and dashboards

This commit is contained in:
jxxghp
2026-05-17 10:04:30 +08:00
parent 6900042cf7
commit 5e8489c620
16 changed files with 88 additions and 100 deletions
+10 -5
View File
@@ -306,9 +306,11 @@ watch(
}, 1000),
)
// 获取订阅列表数据
async function fetchData(page = currentPage.value, count = itemsPerPage.value) {
loading.value = true
// 获取历史记录数据,keep-alive 重新进入时可静默刷新,避免表格出现重新加载感。
async function fetchData(page = currentPage.value, count = itemsPerPage.value, options: { silent?: boolean } = {}) {
if (!options.silent) {
loading.value = true
}
try {
const result: { [key: string]: any } = await api.get('history/transfer', {
@@ -326,8 +328,11 @@ async function fetchData(page = currentPage.value, count = itemsPerPage.value) {
)
} catch (error) {
console.error(error)
} finally {
if (!options.silent) {
loading.value = false
}
}
loading.value = false
}
// 根据 type 返回不同的图标
@@ -761,7 +766,7 @@ onActivated(() => {
}
if (!loading.value) {
fetchData()
fetchData(currentPage.value, itemsPerPage.value, { silent: true })
}
})