From 39766553fa73e41f62bdcddf05784a69882fa9c4 Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Tue, 12 Jul 2022 14:42:21 +0800 Subject: [PATCH] fix: theme colors default --- src/utils/theme/color.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/theme/color.js b/src/utils/theme/color.js index d45ca9b15..cb4fac8c3 100644 --- a/src/utils/theme/color.js +++ b/src/utils/theme/color.js @@ -4,7 +4,7 @@ import defaultThemeConfig from './default.js' export function generateColors(themeColors) { const colors = {} - if (!themeColors) { + if (!themeColors || Object.keys(themeColors).length === 0) { themeColors = defaultThemeConfig } let primaryColor = themeColors @@ -31,7 +31,7 @@ export function generateColors(themeColors) { if (value.includes('danger')) { replaceColor = value.replace(/danger/g, subColor['--color-danger']) } - if (replaceColor) { + if (replaceColor && !replaceColor.includes('undefined')) { const convertColor = color.convert(replaceColor) colors[key] = convertColor.indexOf('rgba') > -1 ? convertColor : colorRgbToHex(convertColor) }