ConfigProvider 全局配置
简介
根全局配置是 Cosey 中必需的全局单例组件,用于进行全局配置。
代码演示
主题配置
表格配置
表格接口相关的 key、工具栏按钮等可通过此组件进行全局配置。
vue
<ConfigProvider
:table="{
keys: {
list: 'list',
total: 'total',
page: 'page',
},
toolbarConfig: {
export: false,
},
}"
>
<router-view></router-view>
</ConfigProvider>table 里的配置都可被单个表格上的同名属性覆盖,例如 :toolbar-config="{ export: true }"。
更多表格配置可参阅 TableConfig。
API
ConfigProviderProps
| 属性 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| theme | 主题配置 | ThemeConfig | - |
| table | 表格配置 | TableConfig | - |
| table-action | 表格操作按钮配置 | TableActionConfig | - |
| locale | 翻译文本对象 | object Languages | - |
ThemeConfig
ts
interface ThemeConfig {
token?: {
colorPrimary?: string;
colorSuccess?: string;
colorWarning?: string;
colorError?: string;
};
}