diff --git a/src/layout/components/Message/src/Message.vue b/src/layout/components/Message/src/Message.vue index 4ac85860..f1bf53b6 100644 --- a/src/layout/components/Message/src/Message.vue +++ b/src/layout/components/Message/src/Message.vue @@ -27,16 +27,19 @@ const goMyList = () => { name: 'MyNotifyMessage' }) } - +let timer: any = 0 // ========== 初始化 ========= onMounted(() => { // 首次加载小红点 getUnreadCount() // 轮询刷新小红点 - setInterval(() => { + timer = setInterval(() => { getUnreadCount() }, 1000 * 60 * 2) }) +onUnmounted(() => { + clearInterval(timer) +})