feat: 前端支持平台子路径,托管时从平台登录进入
This commit is contained in:
@@ -2,8 +2,14 @@ import { computed, ref } from "vue";
|
||||
|
||||
export type ThemeChoice = "system" | "dark" | "light";
|
||||
|
||||
const STORAGE_KEY = "decom-theme";
|
||||
const STORAGE_KEY = "decomeval.theme";
|
||||
const LEGACY_KEY = "decom-theme";
|
||||
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
const legacy = localStorage.getItem(LEGACY_KEY);
|
||||
if (legacy !== null) {
|
||||
if (localStorage.getItem(STORAGE_KEY) === null) localStorage.setItem(STORAGE_KEY, legacy);
|
||||
localStorage.removeItem(LEGACY_KEY);
|
||||
}
|
||||
const stored = localStorage.getItem(STORAGE_KEY);
|
||||
export const themeChoice = ref<ThemeChoice>(stored === "dark" || stored === "light" || stored === "system" ? stored : "system");
|
||||
const systemDark = ref(media.matches);
|
||||
|
||||
Reference in New Issue
Block a user