feat(config): add site_enable_bg property to app configuration and update layout to conditionally render background image

This commit is contained in:
keven1024
2026-05-23 22:19:51 +08:00
parent 71737ebedc
commit c89d1b554f
2 changed files with 5 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ const useMyAppConfig = () => {
site_url: string
site_icon: string
site_bg_url: string
site_enable_bg: boolean
version: string
build_time: number
features: string[]

View File

@@ -4,13 +4,16 @@ const { locale } = useI18n()
await useSeo({ locale: locale.value })
const appConfig = useMyAppConfig()
const bgUrl = computed(() => appConfig.value?.site_bg_url)
const enableBg = computed(() => appConfig.value?.site_enable_bg ?? true)
</script>
<template>
<div class="h-screen w-screen">
<GlobalDrawer />
<GlobalDayjs />
<Toaster position="top-center" richColors closeButton />
<img class="w-full h-full object-cover absolute inset-0 -z-[1] bg-gradient-to-bl from-primary/40 to-primary" :src="bgUrl" />
<div class="w-full h-full absolute inset-0 z-[-1] bg-linear-to-bl from-primary/40 to-primary">
<img v-if="enableBg" class="w-full h-full object-cover" :src="bgUrl" />
</div>
<div class="h-full w-full flex flex-col items-center lg:p-10 p-5 overflow-y-auto">
<Navbar />
<slot />