flat: 修复bug
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user