flat: 修复bug

This commit is contained in:
史典卓
2025-07-21 14:49:45 +08:00
parent ec2dc5f659
commit ea04387b58
17 changed files with 171 additions and 108 deletions

View File

@@ -15,6 +15,22 @@ import {
// 控制消息
export const useReadMsg = defineStore('readMsg', () => {
const msgList = ref([])
const badges = ref([{
count: 0
},
{
count: 0
},
{
count: 0
},
{
count: 0
},
{
count: 0
},
])
// 计算总未读数量,基于 notReadCount 字段
const unreadCount = computed(() =>
@@ -35,9 +51,13 @@ export const useReadMsg = defineStore('readMsg', () => {
index: 3
}) // 替换为你消息页面的 TabBar index
} else {
const val = count > 99 ? '99+' : String(count)
badges.value[index] = {
count: val
}
uni.setTabBarBadge({
index: 3,
text: count > 99 ? '99+' : String(count)
text: val
})
}
}
@@ -76,6 +96,7 @@ export const useReadMsg = defineStore('readMsg', () => {
}
return {
badges,
msgList,
unreadMsgList,
unreadCount,