add: global blur effect
This commit is contained in:
@@ -40,6 +40,18 @@ watch(
|
|||||||
{ immediate: true }
|
{ 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(() => {
|
onMounted(() => {
|
||||||
settingStore.loadSoundPlayers();
|
settingStore.loadSoundPlayers();
|
||||||
window.addEventListener("pointerdown", unlockSoundOnUserGesture, { once: true });
|
window.addEventListener("pointerdown", unlockSoundOnUserGesture, { once: true });
|
||||||
|
|||||||
@@ -291,8 +291,8 @@ html.theme-dark body {
|
|||||||
|
|
||||||
mask: linear-gradient(to top, transparent 0%, #000 60%);
|
mask: linear-gradient(to top, transparent 0%, #000 60%);
|
||||||
-webkit-mask: linear-gradient(to top, transparent 0%, #000 60%);
|
-webkit-mask: linear-gradient(to top, transparent 0%, #000 60%);
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
|
||||||
-webkit-backdrop-filter: 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%);
|
mask: linear-gradient(to bottom, transparent 0%, #000 60%);
|
||||||
-webkit-mask: linear-gradient(to bottom, transparent 0%, #000 60%);
|
-webkit-mask: linear-gradient(to bottom, transparent 0%, #000 60%);
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
|
||||||
-webkit-backdrop-filter: blur(10px);
|
-webkit-backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ onBeforeUnmount(() => {
|
|||||||
background: rgba(255, 255, 255, .86);
|
background: rgba(255, 255, 255, .86);
|
||||||
border-radius: .75rem;
|
border-radius: .75rem;
|
||||||
box-shadow: 0 .25rem 1rem rgba(15, 23, 42, .1);
|
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;
|
flex-direction: column;
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
|
|||||||
@@ -760,7 +760,7 @@ onMounted(() => {
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: 1.75rem;
|
border-radius: 1.75rem;
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
.total {
|
.total {
|
||||||
|
|||||||
@@ -19,6 +19,11 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</t-cell>
|
</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>
|
||||||
<t-cell-group title="声音" theme="card" v-entrance-transition>
|
<t-cell-group title="声音" theme="card" v-entrance-transition>
|
||||||
<t-cell title="扫码成功">
|
<t-cell title="扫码成功">
|
||||||
|
|||||||
+10
-1
@@ -3,6 +3,7 @@ import { defineStore } from "pinia";
|
|||||||
|
|
||||||
export const DEFAULT_BODY_BACKGROUND = "#FFF";
|
export const DEFAULT_BODY_BACKGROUND = "#FFF";
|
||||||
const THEME_STORAGE_KEY = "gao-customer-h5:theme-mode";
|
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";
|
export type ThemeMode = "light" | "dark" | "system";
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ function readStoredThemeMode(): ThemeMode {
|
|||||||
const store = defineStore("globalUI", () => {
|
const store = defineStore("globalUI", () => {
|
||||||
const bodyBackground = ref<string>(DEFAULT_BODY_BACKGROUND);
|
const bodyBackground = ref<string>(DEFAULT_BODY_BACKGROUND);
|
||||||
const themeMode = ref<ThemeMode>(readStoredThemeMode());
|
const themeMode = ref<ThemeMode>(readStoredThemeMode());
|
||||||
|
const backdropBlur = ref(localStorage.getItem(BACKDROP_BLUR_STORAGE_KEY) !== "false");
|
||||||
|
|
||||||
function setBodyBackground(color?: string): void {
|
function setBodyBackground(color?: string): void {
|
||||||
bodyBackground.value = color || DEFAULT_BODY_BACKGROUND;
|
bodyBackground.value = color || DEFAULT_BODY_BACKGROUND;
|
||||||
@@ -28,11 +30,18 @@ const store = defineStore("globalUI", () => {
|
|||||||
localStorage.setItem(THEME_STORAGE_KEY, mode);
|
localStorage.setItem(THEME_STORAGE_KEY, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setBackdropBlur(enabled: boolean): void {
|
||||||
|
backdropBlur.value = enabled;
|
||||||
|
localStorage.setItem(BACKDROP_BLUR_STORAGE_KEY, String(enabled));
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
bodyBackground,
|
bodyBackground,
|
||||||
themeMode,
|
themeMode,
|
||||||
|
backdropBlur,
|
||||||
setBodyBackground,
|
setBodyBackground,
|
||||||
setThemeMode
|
setThemeMode,
|
||||||
|
setBackdropBlur
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user