xt-element-ui 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/components/base/xt-date-picker.md +127 -37
- package/docs/components/base/xt-form-schema.md +358 -0
- package/docs/components/base/xt-grid-box.md +4 -4
- package/docs/components/base/xt-input.md +204 -42
- package/docs/components/base/xt-list.md +458 -458
- package/docs/components/base/xt-text.md +1 -0
- package/docs/components/base/xt-transfer-tree.md +272 -0
- package/docs/components/utils/config.md +285 -0
- package/docs/components/utils/format.md +445 -0
- package/lib/index.common.js +93128 -112769
- package/lib/index.css +1 -1
- package/lib/index.umd.js +93128 -112769
- package/lib/index.umd.min.js +1 -34
- package/package.json +4 -2
- package/src/components/xt-date-picker/component/Picker.vue +196 -0
- package/src/components/xt-date-picker/component/RangeDate.vue +136 -0
- package/src/components/xt-date-picker/index.vue +164 -144
- package/src/components/xt-flex-box/index.vue +1 -1
- package/src/components/xt-form-schema/index.js +8 -0
- package/src/components/xt-form-schema/index.vue +328 -0
- package/src/components/xt-grid-item/index.vue +2 -2
- package/src/components/xt-input/index.vue +224 -28
- package/src/components/xt-input/style/index.scss +10 -0
- package/src/components/xt-list/index.js +7 -7
- package/src/components/xt-list/index.vue +885 -885
- package/src/components/xt-text/index.vue +16 -4
- package/src/components/xt-transfer-tree/index.js +8 -0
- package/src/components/xt-transfer-tree/index.vue +494 -0
- package/src/index.js +8 -2
- package/src/utils/index.js +278 -1
- package/src/components/xt-date-picker/SearchDate.vue +0 -45
- package/src/components/xt-date-picker/quarter.vue +0 -154
- package/src/components/xt-table/index copy.vue +0 -663
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
## XtTransferTree 树形穿梭框组件
|
|
2
|
+
|
|
3
|
+
树形穿梭框组件,支持树形结构数据的穿梭,提供多种穿梭模式满足不同业务场景。
|
|
4
|
+
|
|
5
|
+
## 基本用法
|
|
6
|
+
|
|
7
|
+
::: demo 基本用法
|
|
8
|
+
```vue
|
|
9
|
+
<template>
|
|
10
|
+
<XtTransferTree
|
|
11
|
+
:data="treeData"
|
|
12
|
+
v-model="selectedIds"
|
|
13
|
+
:height="400"
|
|
14
|
+
/>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
data() {
|
|
20
|
+
return {
|
|
21
|
+
selectedIds: [],
|
|
22
|
+
treeData: [
|
|
23
|
+
{
|
|
24
|
+
id: '1',
|
|
25
|
+
label: '一级菜单',
|
|
26
|
+
children: [
|
|
27
|
+
{
|
|
28
|
+
id: '1-1',
|
|
29
|
+
label: '二级菜单1'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: '1-2',
|
|
33
|
+
label: '二级菜单2'
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: '2',
|
|
39
|
+
label: '一级菜单2',
|
|
40
|
+
children: [
|
|
41
|
+
{
|
|
42
|
+
id: '2-1',
|
|
43
|
+
label: '二级菜单3'
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
:::
|
|
54
|
+
|
|
55
|
+
## 属性说明
|
|
56
|
+
|
|
57
|
+
| 属性 | 类型 | 默认值 | 可选值 | 说明 |
|
|
58
|
+
|------|------|--------|--------|------|
|
|
59
|
+
| `value` / `v-model` | Array | `[]` | - | 已选择的节点 ID 数组 |
|
|
60
|
+
| `data` | Array | `[]` | - | 树形数据源 |
|
|
61
|
+
| `leftTitle` | String | `待选择` | - | 左侧面板标题 |
|
|
62
|
+
| `rightTitle` | String | `已选择` | - | 右侧面板标题 |
|
|
63
|
+
| `treeProps` | Object | `{ label, children, value }` | - | 树节点属性配置 |
|
|
64
|
+
| `defaultExpandAll` | Boolean | `true` | - | 是否默认展开所有节点 |
|
|
65
|
+
| `filterable` | Boolean | `false` | - | 是否支持搜索过滤 |
|
|
66
|
+
| `showCheckbox` | Boolean | `true` | - | 是否显示复选框 |
|
|
67
|
+
| `cascade` | Boolean | `true` | - | 是否级联选择 |
|
|
68
|
+
| `transferMode` | String | `single` | `single`, `multiple`, `parent-child` | 穿梭模式 |
|
|
69
|
+
| `buttonSize` | String | `small` | - | 按钮尺寸 |
|
|
70
|
+
|
|
71
|
+
## 穿梭模式说明
|
|
72
|
+
|
|
73
|
+
| 模式 | 说明 |
|
|
74
|
+
|------|------|
|
|
75
|
+
| `single` | 单选模式,点击节点或勾选后只穿梭当前节点 |
|
|
76
|
+
| `multiple` | 多选模式,勾选多个节点后一次性穿梭 |
|
|
77
|
+
| `parent-child` | 父子模式,穿梭父节点时自动包含所有子节点 |
|
|
78
|
+
|
|
79
|
+
## 事件
|
|
80
|
+
|
|
81
|
+
| 事件名 | 说明 | 参数 |
|
|
82
|
+
|--------|------|------|
|
|
83
|
+
| `change` | 数据变化时触发 | `{ value, addedKeys, removedKeys }` |
|
|
84
|
+
|
|
85
|
+
## 示例
|
|
86
|
+
|
|
87
|
+
### 父子级联穿梭
|
|
88
|
+
|
|
89
|
+
::: demo 父子级联穿梭
|
|
90
|
+
```vue
|
|
91
|
+
<template>
|
|
92
|
+
<XtTransferTree
|
|
93
|
+
:data="treeData"
|
|
94
|
+
v-model="selectedIds"
|
|
95
|
+
:height="400"
|
|
96
|
+
transfer-mode="parent-child"
|
|
97
|
+
@change="handleChange"
|
|
98
|
+
/>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script>
|
|
102
|
+
export default {
|
|
103
|
+
data() {
|
|
104
|
+
return {
|
|
105
|
+
selectedIds: [],
|
|
106
|
+
treeData: [
|
|
107
|
+
{
|
|
108
|
+
id: '1',
|
|
109
|
+
label: '部门A',
|
|
110
|
+
children: [
|
|
111
|
+
{ id: '1-1', label: '员工1' },
|
|
112
|
+
{ id: '1-2', label: '员工2' }
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: '2',
|
|
117
|
+
label: '部门B',
|
|
118
|
+
children: [
|
|
119
|
+
{ id: '2-1', label: '员工3' }
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
methods: {
|
|
126
|
+
handleChange({ value, addedKeys, removedKeys }) {
|
|
127
|
+
console.log('已选择:', value)
|
|
128
|
+
console.log('新增:', addedKeys)
|
|
129
|
+
console.log('移除:', removedKeys)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</script>
|
|
134
|
+
```
|
|
135
|
+
:::
|
|
136
|
+
|
|
137
|
+
### 支持搜索过滤
|
|
138
|
+
|
|
139
|
+
::: demo 支持搜索过滤
|
|
140
|
+
```vue
|
|
141
|
+
<template>
|
|
142
|
+
<XtTransferTree
|
|
143
|
+
:data="treeData"
|
|
144
|
+
v-model="selectedIds"
|
|
145
|
+
:height="400"
|
|
146
|
+
:filterable="true"
|
|
147
|
+
/>
|
|
148
|
+
</template>
|
|
149
|
+
|
|
150
|
+
<script>
|
|
151
|
+
export default {
|
|
152
|
+
data() {
|
|
153
|
+
return {
|
|
154
|
+
selectedIds: [],
|
|
155
|
+
treeData: [
|
|
156
|
+
{
|
|
157
|
+
id: '1',
|
|
158
|
+
label: '水果',
|
|
159
|
+
children: [
|
|
160
|
+
{ id: '1-1', label: '苹果' },
|
|
161
|
+
{ id: '1-2', label: '香蕉' },
|
|
162
|
+
{ id: '1-3', label: '橙子' }
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: '2',
|
|
167
|
+
label: '蔬菜',
|
|
168
|
+
children: [
|
|
169
|
+
{ id: '2-1', label: '西红柿' },
|
|
170
|
+
{ id: '2-2', label: '黄瓜' }
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
</script>
|
|
178
|
+
```
|
|
179
|
+
:::
|
|
180
|
+
|
|
181
|
+
### 不级联选择
|
|
182
|
+
|
|
183
|
+
::: demo 不级联选择
|
|
184
|
+
```vue
|
|
185
|
+
<template>
|
|
186
|
+
<XtTransferTree
|
|
187
|
+
:data="treeData"
|
|
188
|
+
v-model="selectedIds"
|
|
189
|
+
:height="400"
|
|
190
|
+
:cascade="false"
|
|
191
|
+
/>
|
|
192
|
+
</template>
|
|
193
|
+
|
|
194
|
+
<script>
|
|
195
|
+
export default {
|
|
196
|
+
data() {
|
|
197
|
+
return {
|
|
198
|
+
selectedIds: [],
|
|
199
|
+
treeData: [
|
|
200
|
+
{
|
|
201
|
+
id: '1',
|
|
202
|
+
label: '分类1',
|
|
203
|
+
children: [
|
|
204
|
+
{ id: '1-1', label: '项目1' },
|
|
205
|
+
{ id: '1-2', label: '项目2' }
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
</script>
|
|
213
|
+
```
|
|
214
|
+
:::
|
|
215
|
+
|
|
216
|
+
### 点击穿梭(无复选框)
|
|
217
|
+
|
|
218
|
+
::: demo 点击穿梭
|
|
219
|
+
```vue
|
|
220
|
+
<template>
|
|
221
|
+
<XtTransferTree
|
|
222
|
+
:data="treeData"
|
|
223
|
+
v-model="selectedIds"
|
|
224
|
+
:height="400"
|
|
225
|
+
:show-checkbox="false"
|
|
226
|
+
/>
|
|
227
|
+
</template>
|
|
228
|
+
|
|
229
|
+
<script>
|
|
230
|
+
export default {
|
|
231
|
+
data() {
|
|
232
|
+
return {
|
|
233
|
+
selectedIds: [],
|
|
234
|
+
treeData: [
|
|
235
|
+
{
|
|
236
|
+
id: '1',
|
|
237
|
+
label: '选项1'
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: '2',
|
|
241
|
+
label: '选项2'
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
</script>
|
|
248
|
+
```
|
|
249
|
+
:::
|
|
250
|
+
|
|
251
|
+
## 方法
|
|
252
|
+
|
|
253
|
+
| 方法名 | 说明 | 参数 |
|
|
254
|
+
|--------|------|------|
|
|
255
|
+
| `clearSelection` | 清空选择 | - |
|
|
256
|
+
|
|
257
|
+
## 数据格式
|
|
258
|
+
|
|
259
|
+
```javascript
|
|
260
|
+
[
|
|
261
|
+
{
|
|
262
|
+
id: 'node-id',
|
|
263
|
+
label: '节点名称',
|
|
264
|
+
children: [
|
|
265
|
+
{
|
|
266
|
+
id: 'child-id',
|
|
267
|
+
label: '子节点名称'
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
```
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
## 全局配置
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
|
|
5
|
+
提供全局配置管理工具函数,包括配置的获取、设置、重置以及主色调配置等功能。
|
|
6
|
+
|
|
7
|
+
## 方法说明
|
|
8
|
+
|
|
9
|
+
### getConfig()
|
|
10
|
+
|
|
11
|
+
获取当前全局配置。
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<div>
|
|
16
|
+
<XtText>当前配置:{{ JSON.stringify(config) }}</XtText>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { getConfig } from 'xt-element-ui'
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
computed: {
|
|
25
|
+
config() {
|
|
26
|
+
return getConfig()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**返回值**:
|
|
34
|
+
|
|
35
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
36
|
+
|------|------|--------|------|
|
|
37
|
+
| `theme` | String | 'white' | 主题类型 |
|
|
38
|
+
| `size` | String | 'medium' | 字体大小 |
|
|
39
|
+
| `primaryColor` | String | '#1890ff' | 主色调 |
|
|
40
|
+
|
|
41
|
+
### setConfig(config)
|
|
42
|
+
|
|
43
|
+
批量设置全局配置。
|
|
44
|
+
|
|
45
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
46
|
+
|------|------|------|------|
|
|
47
|
+
| `config` | Object | 是 | 配置对象 |
|
|
48
|
+
|
|
49
|
+
**config 参数**:
|
|
50
|
+
|
|
51
|
+
| 属性 | 类型 | 说明 |
|
|
52
|
+
|------|------|------|
|
|
53
|
+
| `theme` | String | 主题类型:`white`、`dark` |
|
|
54
|
+
| `size` | String | 字体大小:`small`、`medium`、`large` |
|
|
55
|
+
| `primaryColor` | String | 主色调,十六进制颜色格式 |
|
|
56
|
+
|
|
57
|
+
```vue
|
|
58
|
+
<template>
|
|
59
|
+
<div>
|
|
60
|
+
<XtButton @click="initConfig">初始化配置</XtButton>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script>
|
|
65
|
+
import { setConfig } from 'xt-element-ui'
|
|
66
|
+
|
|
67
|
+
export default {
|
|
68
|
+
methods: {
|
|
69
|
+
initConfig() {
|
|
70
|
+
setConfig({
|
|
71
|
+
theme: 'dark',
|
|
72
|
+
size: 'large',
|
|
73
|
+
primaryColor: '#1890ff'
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</script>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### setPrimaryColor(color)
|
|
82
|
+
|
|
83
|
+
设置全局主色调。
|
|
84
|
+
|
|
85
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
86
|
+
|------|------|------|------|
|
|
87
|
+
| `color` | String | 是 | 十六进制颜色值 |
|
|
88
|
+
|
|
89
|
+
```vue
|
|
90
|
+
<template>
|
|
91
|
+
<div>
|
|
92
|
+
<XtButton @click="changePrimaryColor('#ff5722')">橙色主题</XtButton>
|
|
93
|
+
<XtButton @click="changePrimaryColor('#4caf50')">绿色主题</XtButton>
|
|
94
|
+
</div>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<script>
|
|
98
|
+
import { setPrimaryColor } from 'xt-element-ui'
|
|
99
|
+
|
|
100
|
+
export default {
|
|
101
|
+
methods: {
|
|
102
|
+
changePrimaryColor(color) {
|
|
103
|
+
setPrimaryColor(color)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### getPrimaryColor()
|
|
111
|
+
|
|
112
|
+
获取当前主色调配置。
|
|
113
|
+
|
|
114
|
+
```vue
|
|
115
|
+
<template>
|
|
116
|
+
<div>
|
|
117
|
+
<XtText>当前主色调:{{ currentColor }}</XtText>
|
|
118
|
+
</div>
|
|
119
|
+
</template>
|
|
120
|
+
|
|
121
|
+
<script>
|
|
122
|
+
import { getPrimaryColor } from 'xt-element-ui'
|
|
123
|
+
|
|
124
|
+
export default {
|
|
125
|
+
computed: {
|
|
126
|
+
currentColor() {
|
|
127
|
+
return getPrimaryColor()
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
</script>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### resetConfig()
|
|
135
|
+
|
|
136
|
+
重置为默认配置。
|
|
137
|
+
|
|
138
|
+
```vue
|
|
139
|
+
<template>
|
|
140
|
+
<div>
|
|
141
|
+
<XtButton @click="reset">重置配置</XtButton>
|
|
142
|
+
</div>
|
|
143
|
+
</template>
|
|
144
|
+
|
|
145
|
+
<script>
|
|
146
|
+
import { resetConfig } from 'xt-element-ui'
|
|
147
|
+
|
|
148
|
+
export default {
|
|
149
|
+
methods: {
|
|
150
|
+
reset() {
|
|
151
|
+
resetConfig()
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
</script>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### onConfigChange(listener)
|
|
159
|
+
|
|
160
|
+
监听配置变化,返回取消订阅函数。
|
|
161
|
+
|
|
162
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
163
|
+
|------|------|------|------|
|
|
164
|
+
| `listener` | Function | 是 | 变化监听回调函数 |
|
|
165
|
+
|
|
166
|
+
**回调参数**:
|
|
167
|
+
|
|
168
|
+
| 参数 | 类型 | 说明 |
|
|
169
|
+
|------|------|------|
|
|
170
|
+
| `key` | String | 变化的配置项:`theme`、`size`、`primaryColor` |
|
|
171
|
+
| `value` | Any | 配置项的新值 |
|
|
172
|
+
|
|
173
|
+
```vue
|
|
174
|
+
<template>
|
|
175
|
+
<div>
|
|
176
|
+
<XtText>配置变化次数:{{ changeCount }}</XtText>
|
|
177
|
+
</div>
|
|
178
|
+
</template>
|
|
179
|
+
|
|
180
|
+
<script>
|
|
181
|
+
import { onConfigChange } from 'xt-element-ui'
|
|
182
|
+
|
|
183
|
+
export default {
|
|
184
|
+
data() {
|
|
185
|
+
return {
|
|
186
|
+
changeCount: 0,
|
|
187
|
+
unsubscribe: null
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
mounted() {
|
|
191
|
+
this.unsubscribe = onConfigChange((key, value) => {
|
|
192
|
+
this.changeCount++
|
|
193
|
+
console.log(`配置 ${key} 已变更为:`, value)
|
|
194
|
+
})
|
|
195
|
+
},
|
|
196
|
+
beforeDestroy() {
|
|
197
|
+
if (this.unsubscribe) {
|
|
198
|
+
this.unsubscribe()
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
</script>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## 使用示例
|
|
206
|
+
|
|
207
|
+
### 完整配置示例
|
|
208
|
+
|
|
209
|
+
```vue
|
|
210
|
+
<template>
|
|
211
|
+
<XtCard>
|
|
212
|
+
<XtCardItem title="当前配置">
|
|
213
|
+
<XtText>{{ JSON.stringify(config) }}</XtText>
|
|
214
|
+
</XtCardItem>
|
|
215
|
+
|
|
216
|
+
<XtCardItem title="配置操作">
|
|
217
|
+
<XtFlexBox direction="vertical" style="gap: 12px;">
|
|
218
|
+
<XtButton @click="updateConfig">更新配置</XtButton>
|
|
219
|
+
<XtButton @click="changePrimary('#67c23a')">修改主色调</XtButton>
|
|
220
|
+
<XtButton type="danger" @click="reset">重置</XtButton>
|
|
221
|
+
</XtFlexBox>
|
|
222
|
+
</XtCardItem>
|
|
223
|
+
|
|
224
|
+
<XtCardItem title="配置变化">
|
|
225
|
+
<XtText>变化次数:{{ changeCount }}</XtText>
|
|
226
|
+
</XtCardItem>
|
|
227
|
+
</XtCard>
|
|
228
|
+
</template>
|
|
229
|
+
|
|
230
|
+
<script>
|
|
231
|
+
import {
|
|
232
|
+
getConfig,
|
|
233
|
+
setConfig,
|
|
234
|
+
setPrimaryColor,
|
|
235
|
+
resetConfig,
|
|
236
|
+
onConfigChange
|
|
237
|
+
} from 'xt-element-ui'
|
|
238
|
+
|
|
239
|
+
export default {
|
|
240
|
+
data() {
|
|
241
|
+
return {
|
|
242
|
+
changeCount: 0,
|
|
243
|
+
unsubscribe: null
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
computed: {
|
|
247
|
+
config() {
|
|
248
|
+
return getConfig()
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
mounted() {
|
|
252
|
+
this.unsubscribe = onConfigChange(() => {
|
|
253
|
+
this.changeCount++
|
|
254
|
+
})
|
|
255
|
+
},
|
|
256
|
+
beforeDestroy() {
|
|
257
|
+
if (this.unsubscribe) {
|
|
258
|
+
this.unsubscribe()
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
methods: {
|
|
262
|
+
updateConfig() {
|
|
263
|
+
setConfig({
|
|
264
|
+
theme: 'dark',
|
|
265
|
+
size: 'medium',
|
|
266
|
+
primaryColor: '#1890ff'
|
|
267
|
+
})
|
|
268
|
+
},
|
|
269
|
+
changePrimary(color) {
|
|
270
|
+
setPrimaryColor(color)
|
|
271
|
+
},
|
|
272
|
+
reset() {
|
|
273
|
+
resetConfig()
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
</script>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## 注意事项
|
|
281
|
+
|
|
282
|
+
1. `setPrimaryColor` 只支持十六进制颜色格式(如 `#1890ff`、`#fff`)
|
|
283
|
+
2. 设置主色调时,会自动生成对应的浅色系列(light-3 到 light-9)
|
|
284
|
+
3. `onConfigChange` 返回的取消订阅函数应在组件销毁时调用,避免内存泄漏
|
|
285
|
+
4. 所有配置修改都会触发 `onConfigChange` 监听器
|