首页提示获取邀请数量和通知数量
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-link to="/personalCenter?status=all&message_type=mr">
|
<router-link to="/personalCenter?status=all&message_type=mr">
|
||||||
<d-badge class="g-notice" :count="accountInfo.noticeUnreadNum" :offset="[-2, 4]" :hidden="!accountInfo.noticeUnreadNum" status="danger">
|
<d-badge class="g-notice" :count="totalUnreadCount" :offset="[-2, 4]" :hidden="!totalUnreadCount" status="danger">
|
||||||
<d-icon style="font-size: 16px" name="notice" />
|
<d-icon style="font-size: 16px" name="notice" />
|
||||||
</d-badge>
|
</d-badge>
|
||||||
</router-link>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onBeforeUnmount } from 'vue';
|
import { ref, onMounted, onBeforeUnmount,computed } from 'vue';
|
||||||
import { getMessageCount } from '@/api/notice';
|
import { getMessageCount } from '@/api/notice';
|
||||||
import { addEventListener, offEvent } from '@/utils/eventBus';
|
import { addEventListener, offEvent } from '@/utils/eventBus';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
@@ -23,6 +23,10 @@ const getCounts = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const totalUnreadCount = computed(() => {
|
||||||
|
return (accountInfo.value.noticeUnreadNum || 0) + (accountInfo.value.inviteNum || 0)
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// getCounts();
|
// getCounts();
|
||||||
addEventListener('updateNotice', debounce((count: number) => {
|
addEventListener('updateNotice', debounce((count: number) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user