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
+12
View File
@@ -40,6 +40,18 @@ watch(
{ immediate: true }
);
watch(
() => globalUIStore.backdropBlur,
(enabled) => {
if (enabled) {
document.documentElement.style.removeProperty("--tui-backdrop-blur");
} else {
document.documentElement.style.setProperty("--tui-backdrop-blur", "0px");
}
},
{ immediate: true }
);
onMounted(() => {
settingStore.loadSoundPlayers();
window.addEventListener("pointerdown", unlockSoundOnUserGesture, { once: true });
+4 -4
View File
@@ -291,8 +291,8 @@ html.theme-dark body {
mask: linear-gradient(to top, transparent 0%, #000 60%);
-webkit-mask: linear-gradient(to top, transparent 0%, #000 60%);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
-webkit-backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
}
}
@@ -309,8 +309,8 @@ html.theme-dark body {
mask: linear-gradient(to bottom, transparent 0%, #000 60%);
-webkit-mask: linear-gradient(to bottom, transparent 0%, #000 60%);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
-webkit-backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
}
}
@@ -262,7 +262,7 @@ onBeforeUnmount(() => {
background: rgba(255, 255, 255, .86);
border-radius: .75rem;
box-shadow: 0 .25rem 1rem rgba(15, 23, 42, .1);
backdrop-filter: blur(8px);
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
flex-direction: column;
pointer-events: auto;
user-select: text;
+1 -1
View File
@@ -760,7 +760,7 @@ onMounted(() => {
position: fixed;
align-items: center;
border-radius: 1.75rem;
backdrop-filter: blur(10px);
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
justify-content: space-between;
.total {
+5
View File
@@ -19,6 +19,11 @@
/>
</template>
</t-cell>
<t-cell title="背景模糊特效">
<template #right-icon>
<t-switch :model-value="globalUIStore.backdropBlur" @change="value => globalUIStore.setBackdropBlur(value === true)" />
</template>
</t-cell>
</t-cell-group>
<t-cell-group title="声音" theme="card" v-entrance-transition>
<t-cell title="扫码成功">
+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
};
});