diff --git a/frontend/src/views/Feed.vue b/frontend/src/views/Feed.vue index 014ce64..b8de657 100644 --- a/frontend/src/views/Feed.vue +++ b/frontend/src/views/Feed.vue @@ -39,6 +39,15 @@ const categoryPromptsByArticle = ref>(new Map( const pendingCategory = ref(null) // 正在请求"全部已读"的分类(category 名) let categoryPromptTimer: number | null = null +// 只渲染"还在 items 里"且"有提示条"的 article 列表(给 TransitionGroup 用作 v-for) +// computed 保证响应式 +// - items 没这条 → 不渲染(孤儿) +// - items 有 + Map 也有 → 渲染 +// - items 有 + Map 没 → 不渲染(用户已 dismiss/确认/超时) +const articlesWithPrompts = computed(() => + items.value.filter((a) => (categoryPromptsByArticle.value.get(a.id)?.length ?? 0) > 0) +) + // 移除某篇文章的所有提示条(8 秒超时 / 确认后 / 过滤变化) function clearPromptsForArticle(articleId: number) { if (categoryPromptsByArticle.value.has(articleId)) { @@ -693,14 +702,14 @@ onMounted(async () => {