mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
refactor: standardize keep-alive data refreshing using useKeepAliveRefresh composable across views and dashboards
This commit is contained in:
@@ -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 })
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user