From 5f82bdeb6779b462a80377300531575c0c24a245 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Thu, 4 Dec 2025 14:10:27 +0800 Subject: [PATCH] fix(theme): fix home hero background `tint-plate` rendering fail, close #775 (#776) --- theme/src/client/components/background/TintPlate.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/theme/src/client/components/background/TintPlate.vue b/theme/src/client/components/background/TintPlate.vue index 589a1e9e..dcad91b5 100644 --- a/theme/src/client/components/background/TintPlate.vue +++ b/theme/src/client/components/background/TintPlate.vue @@ -17,9 +17,9 @@ const config = computed(() => { return rgb } if (light || dark) { - return { light, dark } + return cleanObject({ light, dark }) } - return { r, g, b } + return cleanObject({ r, g, b }) }) const lightTint = { @@ -34,6 +34,14 @@ const darkTint = { b: { value: 32, offset: 36 }, } +function cleanObject(obj: any) { + for (const key in obj) { + if (obj[key] === undefined) + delete obj[key] + } + return obj +} + function toPlate(plate: number | string) { return typeof plate === 'number' || Number(plate) === Number.parseInt(plate) ? [plate, plate, plate].map(n => Number(n))