diff --git a/src/config-provider/README.md b/src/config-provider/README.md index ca9ba1088..3560871c8 100644 --- a/src/config-provider/README.md +++ b/src/config-provider/README.md @@ -114,9 +114,18 @@ export default { > Tips:ConfigProvider only affects its child components. -### CSS Variables +### Basic Variables -There are some **Basic Variables** below, for component CSS Variables, please refer to the documentation of each component. +CSS variables in Vant are divided into **basic variables** and **component variables**. Component variables will inherit the basic variables. After modifying the basic variables, all related components will be affected. + +#### Modify Basic Variables + +- The basic variables can only be modified through the `root` selector. +- The component variables can be modified through the `root` selector and `ConfigProvider` component. + +#### Variable List + +There are all **Basic Variables** below, for component CSS Variables, please refer to the documentation of each component. ```less // Color Palette diff --git a/src/config-provider/README.zh-CN.md b/src/config-provider/README.zh-CN.md index 2f6e214ab..99af56989 100644 --- a/src/config-provider/README.zh-CN.md +++ b/src/config-provider/README.zh-CN.md @@ -114,9 +114,20 @@ export default { > 注意:ConfigProvider 仅影响它的子组件的样式,不影响全局 root 节点。 -### CSS 变量 +### 基础变量 -下面是所有的**基础样式变量**,所有组件的样式变量请参考各个组件文档底部的表格。 +Vant 中的 CSS 变量分为 **基础变量** 和 **组件变量**。组件变量会继承基础变量,因此在修改基础变量后,会影响所有相关的组件。 + +#### 修改变量 + +由于 CSS 变量继承机制的原因, 两者的修改方式有一定差异: + +- 基础变量只能通过 `root 选择器` 修改,不能通过 `ConfigProvider 组件` 修改。 +- 组件变量可以通过 `root 选择器` 和 `ConfigProvider 组件` 修改。 + +#### 变量列表 + +下面是所有的基础变量: ```less // Color Palette @@ -193,6 +204,8 @@ export default { --van-border-radius-max: 999px; ``` +你可以在各个组件文档底部的表格中查看组件变量。 + ## API ### Props