feat: add refresh home

This commit is contained in:
tim
2025-08-15 13:24:00 +08:00
parent f025e82e7c
commit 84ca6fd28c
2 changed files with 3 additions and 1 deletions

View File

@@ -127,6 +127,7 @@ const goToNewPost = () => {
const refrechData = async () => { const refrechData = async () => {
await fetchUnreadCount() await fetchUnreadCount()
window.dispatchEvent(new Event('refresh-home'))
} }
const headerMenuItems = computed(() => [ const headerMenuItems = computed(() => [

View File

@@ -351,6 +351,8 @@ if (import.meta.server) {
} }
onMounted(() => { onMounted(() => {
if (categoryOptions.value.length === 0 && tagOptions.value.length === 0) loadOptions() if (categoryOptions.value.length === 0 && tagOptions.value.length === 0) loadOptions()
window.addEventListener('refresh-home', refreshFirst)
}) })
/** 其他工具函数 **/ /** 其他工具函数 **/
@@ -381,7 +383,6 @@ const sanitizeDescription = (text) => stripMarkdown(text)
font-weight: bold; font-weight: bold;
} }
.loading-container { .loading-container {
display: flex; display: flex;
justify-content: center; justify-content: center;