add: global blur effect

This commit is contained in:
Timi
2026-11-08 01:53:25 +08:00
parent 998348f5be
commit 78491232ee
6 changed files with 33 additions and 7 deletions
+10 -1
View File
@@ -3,6 +3,7 @@ import { defineStore } from "pinia";
export const DEFAULT_BODY_BACKGROUND = "#FFF";
const THEME_STORAGE_KEY = "gao-customer-h5:theme-mode";
const BACKDROP_BLUR_STORAGE_KEY = "gao-customer-h5:backdrop-blur";
export type ThemeMode = "light" | "dark" | "system";
@@ -18,6 +19,7 @@ function readStoredThemeMode(): ThemeMode {
const store = defineStore("globalUI", () => {
const bodyBackground = ref<string>(DEFAULT_BODY_BACKGROUND);
const themeMode = ref<ThemeMode>(readStoredThemeMode());
const backdropBlur = ref(localStorage.getItem(BACKDROP_BLUR_STORAGE_KEY) !== "false");
function setBodyBackground(color?: string): void {
bodyBackground.value = color || DEFAULT_BODY_BACKGROUND;
@@ -28,11 +30,18 @@ const store = defineStore("globalUI", () => {
localStorage.setItem(THEME_STORAGE_KEY, mode);
}
function setBackdropBlur(enabled: boolean): void {
backdropBlur.value = enabled;
localStorage.setItem(BACKDROP_BLUR_STORAGE_KEY, String(enabled));
}
return {
bodyBackground,
themeMode,
backdropBlur,
setBodyBackground,
setThemeMode
setThemeMode,
setBackdropBlur
};
});