|
@@ -5,7 +5,7 @@ import { ref } from "vue";
|
|
|
export const useThemeStore = defineStore("theme", () => {
|
|
export const useThemeStore = defineStore("theme", () => {
|
|
|
// 默认从 localStorage 读取,如果没有则根据系统偏好或默认 'light'
|
|
// 默认从 localStorage 读取,如果没有则根据系统偏好或默认 'light'
|
|
|
const theme = ref<"light" | "dark">(
|
|
const theme = ref<"light" | "dark">(
|
|
|
- (localStorage.getItem("theme") as "light" | "dark") || "light",
|
|
|
|
|
|
|
+ (localStorage.getItem("theme") as "light" | "dark") || "dark",
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
const setTheme = (newTheme: "light" | "dark") => {
|
|
const setTheme = (newTheme: "light" | "dark") => {
|