feat: 添加 vue-sonner,优化反馈

This commit is contained in:
2026-05-23 14:37:53 +08:00
parent 7d68db723b
commit e317e117d9
9 changed files with 141 additions and 12 deletions
+6 -9
View File
@@ -12,14 +12,10 @@ import {
import { Button } from "@/components/ui/button";
import { useAuthStore } from "@/stores/auth";
import { useGlobalStore } from "@/stores/global";
/** 使用 VueUse 的 useColorMode 切换 dark/lightclass 会挂到 <html> 上 */
const colorMode = useColorMode();
const isDark = computed(() => colorMode.value === "dark");
const toggleColorMode = () => {
colorMode.value = isDark.value ? "light" : "dark";
};
/** 主题状态由 themeStore 统一管理,持久化由 @nuxtjs/color-mode 处理 */
const themeStore = useGlobalStore();
const authStore = useAuthStore();
@@ -45,6 +41,7 @@ const isActive = (to: string) => {
return route.path.startsWith(to);
};
// 退出登录
const handleSignOut = async () => {
await authStore.signOut();
await navigateTo("/login");
@@ -93,9 +90,9 @@ const handleSignOut = async () => {
variant="ghost"
size="icon"
aria-label="切换主题"
@click="toggleColorMode"
@click="themeStore.toggle"
>
<Sun v-if="isDark" class="size-4" />
<Sun v-if="themeStore.isDark" class="size-4" />
<Moon v-else class="size-4" />
</Button>