fix: notification count still displays when closing alert #51

This commit is contained in:
Hakadao
2023-10-22 15:13:50 +08:00
parent d87f2c1ddd
commit 15d4cb49df
2 changed files with 3 additions and 5 deletions

View File

@@ -36,7 +36,7 @@ const isLogin = ref<boolean>(false)
const unReadMessage = reactive<UnReadMessage | {}>(
{},
) as UnwrapNestedRefs<UnReadMessage>
const unReadDm = reactive<UnReadDm | {}>({} as UnwrapNestedRefs<UnReadDm>)
const unReadDm = reactive<UnReadDm>({} as UnwrapNestedRefs<UnReadDm>)
const unReadMessageCount = ref<number>(0)
const newMomentsCount = ref<number>(0)
@@ -162,9 +162,7 @@ async function getUnreadMessageCount() {
})
if (res.code === 0) {
Object.assign(unReadDm, res.data)
Object.entries(unReadDm).forEach(([, value]) => {
unReadMessageCount.value += typeof value === 'number' ? value : 0
})
unReadMessageCount.value += unReadDm.follow_unread
}
}
catch (error) {

View File

@@ -61,7 +61,7 @@ export default defineComponent({
}).then((res) => {
if (res.code === 0) {
const resData = res.data
this.list[4].unreadCount = parseInt(resData.unfollow_unread) + parseInt(resData.follow_unread)
this.list[4].unreadCount = resData.follow_unread
}
}).catch(() => {
this.list[4].unreadCount = 0