From 344c499462433a8ca61944b33b79af04bf2f50be Mon Sep 17 00:00:00 2001 From: Vben Date: Fri, 9 Aug 2024 23:43:32 +0800 Subject: [PATCH] fix: when borderRaidus is a string, the component displays an exception (#4102) --- packages/effects/hooks/src/use-design-tokens.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/effects/hooks/src/use-design-tokens.ts b/packages/effects/hooks/src/use-design-tokens.ts index 9bd129a1..e7c5740d 100644 --- a/packages/effects/hooks/src/use-design-tokens.ts +++ b/packages/effects/hooks/src/use-design-tokens.ts @@ -56,7 +56,9 @@ export function useAntdDesignTokens() { tokens.colorBgBase = getCssVariableValue('--background'); - tokens.borderRadius = getCssVariableValue('--radius', false); + const radius = Number.parseFloat(getCssVariableValue('--radius', false)); + // 1rem = 16px + tokens.borderRadius = radius * 16; tokens.colorBgLayout = getCssVariableValue('--background-deep'); tokens.colorBgMask = getCssVariableValue('--overlay');