Browse Source

fix: when borderRaidus is a string, the component displays an exception (#4102)

Vben 7 tháng trước cách đây
mục cha
commit
344c499462
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      packages/effects/hooks/src/use-design-tokens.ts

+ 3 - 1
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');