feat:在多个组件中添加onActivated钩子以优化数据加载逻辑

This commit is contained in:
jxxghp
2025-02-11 17:15:55 +08:00
parent 3df5d75c46
commit 787cccb89f
4 changed files with 13 additions and 1 deletions
+4
View File
@@ -30,6 +30,10 @@ async function loadExtraDiscoverSources() {
onMounted(async () => { onMounted(async () => {
await loadExtraDiscoverSources() await loadExtraDiscoverSources()
}) })
onActivated(async () => {
loadExtraDiscoverSources()
})
</script> </script>
<template> <template>
+4
View File
@@ -29,6 +29,10 @@ function jumpTab(tab: string) {
onMounted(async () => { onMounted(async () => {
await loadDownloaderSetting() await loadDownloaderSetting()
}) })
onActivated(async () => {
loadDownloaderSetting()
})
</script> </script>
<template> <template>
+4
View File
@@ -145,6 +145,10 @@ onBeforeMount(async () => {
onMounted(async () => { onMounted(async () => {
await loadExtraRecommendSources() await loadExtraRecommendSources()
}) })
onActivated(async () => {
loadExtraRecommendSources()
})
</script> </script>
<template> <template>
+1 -1
View File
@@ -128,7 +128,7 @@ onMounted(async () => {
onActivated(async () => { onActivated(async () => {
if (!loading.value) { if (!loading.value) {
await fetchData() fetchData()
} }
}) })
</script> </script>