liu
4 天以前 2b695bfabdceccb0ee19c12c8e655bd7f47a6e2f
src/packages/@core/preferences/src/update-css-variables.ts
@@ -67,16 +67,30 @@
    document.documentElement.style.setProperty('--radius', `${radius}rem`);
  }
  // 更新字体大小
  // 更新全局字体大小
  if (Reflect.has(theme, 'fontSize')) {
    const fontSize = theme.fontSize;
    document.documentElement.style.setProperty(
      '--font-size-base',
      `${fontSize}px`,
    );
  }
  // 更新菜单字号(独立于全局字体大小,可在偏好设置中调整)
  const navigation = preferences?.navigation;
  if (navigation && Reflect.has(navigation, 'fontSize')) {
    document.documentElement.style.setProperty(
      '--menu-font-size',
      `calc(${fontSize}px * 0.875)`,
      `${navigation.fontSize}px`,
    );
  }
  // 更新首页字号缩放比例(百分比转换为倍数,供首页样式 calc 使用)
  const app = preferences?.app;
  if (app && Reflect.has(app, 'homeFontSize')) {
    root.style.setProperty(
      '--portal-font-scale',
      String(app.homeFontSize / 100),
    );
  }
}