mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 01:41:20 +08:00
b051efd1b7
- Add experimental feature toggle to config provider - Add experimental feature toggle documentation - Update test cases against feature toggle
70 lines
5.3 KiB
Markdown
70 lines
5.3 KiB
Markdown
---
|
|
title: Config Provider
|
|
lang: en-US
|
|
---
|
|
|
|
# Config Provider
|
|
|
|
Config Provider is used for providing global configurations, which enables your entire application to access these configurations everywhere.
|
|
|
|
## i18n Configurations
|
|
|
|
Configure i18n related properties via Config Provider, to get language switching feature.
|
|
|
|
:::demo Use two attributes to provide i18n related config
|
|
|
|
config-provider/usage
|
|
|
|
:::
|
|
|
|
## Button Configurations
|
|
|
|
:::demo
|
|
|
|
config-provider/button
|
|
|
|
:::
|
|
|
|
## Message Configurations
|
|
|
|
:::demo
|
|
|
|
config-provider/message
|
|
|
|
:::
|
|
|
|
## Experimental features
|
|
|
|
In this section, you can learn how to use Config Provider to provide experimental features. For now, we haven't added any experimental features, but in the feature roadmap, we will add some experimental features. You can use this config to manage the features you want or not.
|
|
|
|
// TODO
|
|
|
|
## Config Provider Attributes
|
|
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
| --------------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
| locale | Locale Object | [Language](https://github.com/element-plus/element-plus/blob/a98ff9b40c0c3d2b9959f99919bd8363e3e3c25a/packages/locale/index.ts#L5) | [languages](https://github.com/element-plus/element-plus/tree/dev/packages/locale/lang) | [English](https://github.com/element-plus/element-plus/blob/dev/packages/locale/lang/en.ts) |
|
|
| size | global component size | string | large / default /small | default |
|
|
| zIndex | global Initial zIndex | number | - | - |
|
|
| button | button related configuration, [see the following table](#button-attributes) | ButtonGlobalConfig | - | see the following table |
|
|
| message | message related configuration, [see the following table](#message-attributes) | MessageGlobalConfig | - | see the following table |
|
|
| experimental-features | features at experimental stage to be added, all features are default to be set to false | Object | - | - |
|
|
|
|
## Button Attributes
|
|
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
| --------------- | ----------------------------------------------------------- | ------- | --------------- | ------- |
|
|
| autoInsertSpace | automatically insert a space between two chinese characters | boolean | - | false |
|
|
|
|
## Message Attributes
|
|
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
| --------- | --------------------------------------------------------------------- | ------ | --------------- | ------- |
|
|
| max | the maximum number of messages that can be displayed at the same time | number | - | - |
|
|
|
|
## ConfigProvider Slots
|
|
|
|
| Name | Description | Scope |
|
|
| ---- | ------------------------- | ------------------------------------------------------- |
|
|
| - | customize default content | config: provided global config (inherited from the top) |
|