|
@@ -8,6 +8,15 @@ dir: column
|
|
|
brief: Provide a unified global configuration for components.
|
|
|
---
|
|
|
|
|
|
+## Scenes to be used
|
|
|
+
|
|
|
+Coverage configuration is divided into two scenarios
|
|
|
+
|
|
|
+- When you need to override sub-component configuration, use ConfigProvider
|
|
|
+- When you need to globally modify component Props, use semiGlobal
|
|
|
+
|
|
|
+
|
|
|
+## ConfigProvider
|
|
|
|
|
|
## Demos
|
|
|
|
|
@@ -413,4 +422,36 @@ const SemiWebpackPlugin = require('@douyinfe/semi-webpack-plugin').default;
|
|
|
module.exports = {
|
|
|
+ plugins: [new SemiWebpackPlugin({ prefixCls: 'imes' })],
|
|
|
}
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+## semiGlobal
|
|
|
+
|
|
|
+You can override the default Props of global components
|
|
|
+
|
|
|
+In `semiGlobal.config.overrideDefaultProps` you can configure the component default Props. You need to put your configuration at the entrance of the entire site, that is, it will be executed before all semi components.
|
|
|
+
|
|
|
+<Notice title={"Notes"}>
|
|
|
+semiGlobal is a singleton mode that affects the entire site. If you only want to cover certain components in certain places, it is recommended not to use semiGlobal. Instead, encapsulate the corresponding components that need to be covered and pass in the modified default props.
|
|
|
+</Notice>
|
|
|
+
|
|
|
+For example, the configuration below sets all Buttons to warning by default, and the zIndex of Select to 2000 by default, etc.
|
|
|
+
|
|
|
+```js
|
|
|
+import { semiGlobal } from "@douiyinfe/semi-ui"
|
|
|
+
|
|
|
+semiGlobal.config.overrideDefaultProps = {
|
|
|
+ Button: {
|
|
|
+ type: 'warning',
|
|
|
+ },
|
|
|
+ Select: {
|
|
|
+ zIndex: 2000,
|
|
|
+ },
|
|
|
+ Tooltip: {
|
|
|
+ zIndex: 2001,
|
|
|
+ trigger:"click"
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
```
|