docs: 消息详情页查看后刷新未读消息数
- 消息详情页获取详情后调用 userStore.fetchUserInfo(true) - 刷新用户信息以更新 unreadMsgCount - 从而使 TabBar 红点状态同步更新 修改文件: - src/pages/message-detail/index.vue: 添加 useUserStore 导入和刷新调用 - src/api/news.js: 修复注释格式(全角分号) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Showing
2 changed files
with
5 additions
and
0 deletions
| ... | @@ -51,6 +51,7 @@ import { ref, computed } from 'vue' | ... | @@ -51,6 +51,7 @@ import { ref, computed } from 'vue' |
| 51 | import { useLoad } from '@tarojs/taro' | 51 | import { useLoad } from '@tarojs/taro' |
| 52 | import NavHeader from '@/components/navigation/NavHeader.vue' | 52 | import NavHeader from '@/components/navigation/NavHeader.vue' |
| 53 | import { detailAPI } from '@/api/news' | 53 | import { detailAPI } from '@/api/news' |
| 54 | +import { useUserStore } from '@/stores/user' | ||
| 54 | 55 | ||
| 55 | const detail = ref(null) | 56 | const detail = ref(null) |
| 56 | const loading = ref(true) | 57 | const loading = ref(true) |
| ... | @@ -86,6 +87,10 @@ const fetchDetail = async (id) => { | ... | @@ -86,6 +87,10 @@ const fetchDetail = async (id) => { |
| 86 | ...res.data, | 87 | ...res.data, |
| 87 | title: res.data.title || mockTitle | 88 | title: res.data.title || mockTitle |
| 88 | } | 89 | } |
| 90 | + | ||
| 91 | + // 查看消息后刷新用户信息,更新未读消息数 | ||
| 92 | + const userStore = useUserStore() | ||
| 93 | + await userStore.fetchUserInfo(true) | ||
| 89 | } | 94 | } |
| 90 | } catch (err) { | 95 | } catch (err) { |
| 91 | console.error('获取消息详情失败:', err) | 96 | console.error('获取消息详情失败:', err) | ... | ... |
-
Please register or login to post a comment