diff --git a/frontend_nuxt/components/HeaderComponent.vue b/frontend_nuxt/components/HeaderComponent.vue
index 46a858c0a..f28810f0f 100644
--- a/frontend_nuxt/components/HeaderComponent.vue
+++ b/frontend_nuxt/components/HeaderComponent.vue
@@ -25,6 +25,10 @@
+
+
+
+
@@ -64,6 +68,8 @@ import SearchDropdown from '~/components/SearchDropdown.vue'
import { authState, clearToken, loadCurrentUser } from '~/utils/auth'
import { fetchUnreadCount, notificationState } from '~/utils/notification'
import { useIsMobile } from '~/utils/screen'
+import { themeState, cycleTheme, ThemeMode } from '~/utils/theme'
+
const props = defineProps({
showMenuBtn: {
type: Boolean,
@@ -136,6 +142,18 @@ const headerMenuItems = computed(() => [
{ text: '退出', onClick: goToLogout },
])
+ /** 其余逻辑保持不变 */
+ const iconClass = computed(() => {
+ switch (themeState.mode) {
+ case ThemeMode.DARK:
+ return 'fas fa-moon'
+ case ThemeMode.LIGHT:
+ return 'fas fa-sun'
+ default:
+ return 'fas fa-desktop'
+ }
+ })
+
onMounted(async () => {
const updateAvatar = async () => {
if (authState.loggedIn) {
@@ -287,7 +305,7 @@ onMounted(async () => {
background-color: var(--menu-selected-background-color);
}
-.search-icon {
+.search-icon, .theme-icon {
font-size: 18px;
cursor: pointer;
}
diff --git a/frontend_nuxt/components/MenuComponent.vue b/frontend_nuxt/components/MenuComponent.vue
index c82ed43a2..883b3ee06 100644
--- a/frontend_nuxt/components/MenuComponent.vue
+++ b/frontend_nuxt/components/MenuComponent.vue
@@ -117,7 +117,7 @@
-
+