From e76369e8d2965224c109a62cf6c291d9f87f5507 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Tue, 15 Aug 2023 22:13:00 +0800 Subject: [PATCH] refactor: refactor coding style --- src/components/Topbar/Topbar.vue | 18 +++++++++++------- .../views/Home/components/RecommendContent.vue | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/Topbar/Topbar.vue b/src/components/Topbar/Topbar.vue index 4a219d1c..61f12dee 100644 --- a/src/components/Topbar/Topbar.vue +++ b/src/components/Topbar/Topbar.vue @@ -41,16 +41,18 @@ const avatarImg = ref() as Ref const avatarShadow = ref() as Ref watch( - () => showNotificationsPop, - () => { - getUnreadMessageCount() + showNotificationsPop, + (newVal) => { + if (!newVal) + getUnreadMessageCount() }, ) watch( - () => showMomentsPop, - () => { - getNewMomentsCount() + showMomentsPop, + (newVal) => { + if (!newVal) + getNewMomentsCount() }, ) @@ -110,7 +112,9 @@ async function getUserInfo() { Object.assign(userInfo, res.data) } // Account not logged in - else if (res.code === -101) { isLogin.value = false } + else if (res.code === -101) { + isLogin.value = false + } } catch (error) { isLogin.value = false diff --git a/src/contentScripts/views/Home/components/RecommendContent.vue b/src/contentScripts/views/Home/components/RecommendContent.vue index 05784ae0..d92b2d76 100644 --- a/src/contentScripts/views/Home/components/RecommendContent.vue +++ b/src/contentScripts/views/Home/components/RecommendContent.vue @@ -175,7 +175,7 @@ function jumpToLoginPage() { -