diff --git a/src/components/Topbar/Topbar.vue b/src/components/Topbar/Topbar.vue index 578a54df..048e328d 100644 --- a/src/components/Topbar/Topbar.vue +++ b/src/components/Topbar/Topbar.vue @@ -28,6 +28,8 @@ const showUploadPop = ref(false) const showHistoryPop = ref(false) const showMorePop = ref(false) +const momentsPopKey = ref(`momentsPop[${Number(new Date())}]`) + const isLogin = ref(false) const unReadMessage = reactive( {}, @@ -46,7 +48,7 @@ watch( if (newVal === oldVal) return - if (!newVal) + if (newVal) getUnreadMessageCount() }, ) @@ -57,7 +59,7 @@ watch( if (newVal === oldVal) return - if (!newVal) + if (newVal) await getNewMomentsCount() }, ) @@ -168,6 +170,9 @@ async function getNewMomentsCount() { contentScriptQuery: 'getNewMomentsCount', }) newMomentsCount.value = res.data.update_info.item.count + // If moments count > 0 then refresh the key to get the new moments + if (newMomentsCount.value > 0) + momentsPopKey.value = `momentsPop[${Number(new Date())}]` } catch { newMomentsCount.value = 0 @@ -353,9 +358,9 @@ async function getNewMomentsCount() { - - - + + +