Skip to content

TDesign Snippets

LayoutContent

类名称生成的片段

typescript
[
  `${prefix}-side-nav`,
  {
    [`${prefix}-side-nav-no-fixed`]: !isFixed,
    [`${prefix}-side-nav-mix-fixed`]: layout === 'mix' && isFixed,
  },
];

批量获取值并赋值

typescript
const initStyleConfig = () => {
    const styleConfig = STYLE_CONFIG;
    for (const key in styleConfig) {
        // 检测一个对象中是否含有自定义属性
        if (Object.prototype.hasOwnProperty.call(styleConfig, key)) {
            // 设置 KEY 的数据
            (styleConfig[key as keyof typeof STYLE_CONFIG] as any) = settingStore[key as keyof typeof STYLE_CONFIG];
        }
    }
    return styleConfig;
};
  • [ ] 副作用函数以及作用
  • [ ] 调整全局的字体和样式
  • [ ] 对模块的注册进行拆离