xt-element-ui 2.2.2 → 2.2.4
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/README.md +140 -192
- package/docs/README.md +162 -81
- package/docs/components/base/theme.md +248 -0
- package/docs/components/base/xt-button.md +11 -4
- package/docs/components/base/xt-card.md +5 -11
- package/docs/components/base/xt-config-provider.md +2 -0
- package/docs/components/base/xt-flow.md +404 -0
- package/docs/components/base/xt-list.md +1 -1
- package/docs/components/base/xt-multi.md +5 -5
- package/docs/components/base/xt-scroll-arrow.md +87 -1
- package/docs/components/base/xt-scroll.md +237 -0
- package/docs/components/business/xt-chart.md +1 -0
- package/docs/components/utils/config.md +18 -4
- package/docs/components/utils/theme.md +280 -183
- package/lib/index.common.1.js +4 -26
- package/lib/index.common.2.js +1 -1
- package/lib/index.common.js +4577 -109925
- package/lib/index.css +1 -1
- package/lib/index.umd.1.js +4 -26
- package/lib/index.umd.2.js +1 -1
- package/lib/index.umd.js +4583 -109930
- package/lib/index.umd.min.1.js +1 -1
- package/lib/index.umd.min.js +1 -1
- package/lib/theme/element-overrides.css +607 -0
- package/lib/theme/element-vars.css +280 -0
- package/lib/xt-badge/xt-badge.common.js +1 -1
- package/lib/xt-badge/xt-badge.css +1 -1
- package/lib/xt-badge/xt-badge.umd.js +1 -1
- package/lib/xt-button/xt-button.common.js +13 -8
- package/lib/xt-button/xt-button.css +1 -1
- package/lib/xt-button/xt-button.umd.js +13 -8
- package/lib/xt-button/xt-button.umd.min.js +1 -1
- package/lib/xt-card/xt-card.common.js +5 -5
- package/lib/xt-card/xt-card.umd.js +5 -5
- package/lib/xt-card/xt-card.umd.min.js +1 -1
- package/lib/xt-card-item/xt-card-item.common.js +4 -4
- package/lib/xt-card-item/xt-card-item.umd.js +4 -4
- package/lib/xt-card-item/xt-card-item.umd.min.js +1 -1
- package/lib/xt-chart/xt-chart.common.js +1969 -108924
- package/lib/xt-chart/xt-chart.css +1 -1
- package/lib/xt-chart/xt-chart.umd.js +1975 -108929
- package/lib/xt-chart/xt-chart.umd.min.js +1 -1
- package/lib/xt-config-provider/xt-config-provider.common.js +561 -107504
- package/lib/xt-config-provider/xt-config-provider.css +1 -1
- package/lib/xt-config-provider/xt-config-provider.umd.js +567 -107509
- package/lib/xt-config-provider/xt-config-provider.umd.min.js +1 -1
- package/lib/xt-date-picker/xt-date-picker.common.1.js +4 -26
- package/lib/xt-date-picker/xt-date-picker.common.2.js +1 -1
- package/lib/xt-date-picker/xt-date-picker.common.js +1 -47
- package/lib/xt-date-picker/xt-date-picker.css +1 -1
- package/lib/xt-date-picker/xt-date-picker.umd.1.js +4 -26
- package/lib/xt-date-picker/xt-date-picker.umd.2.js +1 -1
- package/lib/xt-date-picker/xt-date-picker.umd.js +1 -47
- package/lib/xt-date-picker/xt-date-picker.umd.min.1.js +1 -1
- package/lib/xt-date-picker/xt-date-picker.umd.min.js +1 -1
- package/lib/xt-flex-box/xt-flex-box.common.js +1 -1
- package/lib/xt-flex-box/xt-flex-box.umd.js +1 -1
- package/lib/xt-flow/demo.html +10 -0
- package/lib/xt-flow/index.js +1 -0
- package/lib/xt-flow/xt-flow.common.js +638 -0
- package/lib/xt-flow/xt-flow.css +1 -0
- package/lib/xt-flow/xt-flow.umd.js +648 -0
- package/lib/xt-flow/xt-flow.umd.min.js +1 -0
- package/lib/xt-form-schema/xt-form-schema.common.js +1 -1
- package/lib/xt-form-schema/xt-form-schema.umd.js +1 -1
- package/lib/xt-grid-box/xt-grid-box.common.js +1 -1
- package/lib/xt-grid-box/xt-grid-box.umd.js +1 -1
- package/lib/xt-grid-item/xt-grid-item.common.js +1 -1
- package/lib/xt-grid-item/xt-grid-item.umd.js +1 -1
- package/lib/xt-icon/xt-icon.common.js +1 -1
- package/lib/xt-icon/xt-icon.umd.js +1 -1
- package/lib/xt-input/xt-input.common.js +1 -1
- package/lib/xt-input/xt-input.umd.js +1 -1
- package/lib/xt-list/xt-list.common.js +457 -118
- package/lib/xt-list/xt-list.css +1 -1
- package/lib/xt-list/xt-list.umd.js +457 -118
- package/lib/xt-list/xt-list.umd.min.js +1 -1
- package/lib/xt-map/xt-map.common.js +1 -1
- package/lib/xt-map/xt-map.umd.js +1 -1
- package/lib/xt-map-provider/xt-map-provider.common.js +1 -1
- package/lib/xt-map-provider/xt-map-provider.umd.js +1 -1
- package/lib/xt-page/xt-page.common.js +1 -1
- package/lib/xt-page/xt-page.umd.js +1 -1
- package/lib/xt-progress/xt-progress.common.js +1 -1
- package/lib/xt-progress/xt-progress.umd.js +1 -1
- package/lib/xt-scroll/demo.html +10 -0
- package/lib/xt-scroll/index.js +1 -0
- package/lib/xt-scroll/xt-scroll.common.js +551 -0
- package/lib/xt-scroll/xt-scroll.css +1 -0
- package/lib/xt-scroll/xt-scroll.umd.js +561 -0
- package/lib/xt-scroll/xt-scroll.umd.min.js +1 -0
- package/lib/xt-scroll-arrow/xt-scroll-arrow.common.js +591 -170
- package/lib/xt-scroll-arrow/xt-scroll-arrow.css +1 -1
- package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.js +591 -170
- package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.min.js +1 -1
- package/lib/xt-select-tree/xt-select-tree.common.js +1 -1
- package/lib/xt-select-tree/xt-select-tree.umd.js +1 -1
- package/lib/xt-step-price/xt-step-price.common.js +2 -2
- package/lib/xt-step-price/xt-step-price.umd.js +2 -2
- package/lib/xt-step-price-item/xt-step-price-item.common.js +1 -1
- package/lib/xt-step-price-item/xt-step-price-item.umd.js +1 -1
- package/lib/xt-tab-pane/xt-tab-pane.common.js +1 -1
- package/lib/xt-tab-pane/xt-tab-pane.umd.js +1 -1
- package/lib/xt-table/xt-table.common.js +2 -2
- package/lib/xt-table/xt-table.umd.js +2 -2
- package/lib/xt-tabs/xt-tabs.common.js +1 -1
- package/lib/xt-tabs/xt-tabs.umd.js +1 -1
- package/lib/xt-text/xt-text.common.js +1 -1
- package/lib/xt-text/xt-text.css +1 -1
- package/lib/xt-text/xt-text.umd.js +1 -1
- package/lib/xt-time/xt-time.common.js +1 -1
- package/lib/xt-time/xt-time.umd.js +1 -1
- package/lib/xt-transfer-tree/xt-transfer-tree.common.js +1 -1
- package/lib/xt-transfer-tree/xt-transfer-tree.umd.js +1 -1
- package/lib/xt-upload/xt-upload.common.js +11 -11
- package/lib/xt-upload/xt-upload.umd.js +12 -12
- package/lib/xt-upload/xt-upload.umd.min.js +1 -1
- package/package.json +6 -5
- package/src/components/index.scss +7 -1
- package/src/components/theme/element-overrides.css +607 -0
- package/src/components/theme/element-vars.css +280 -0
- package/src/components/theme/iframe-injector.js +502 -0
- package/src/components/theme/index.js +64 -0
- package/src/components/xt-badge/style/index.scss +6 -6
- package/src/components/xt-button/index.vue +11 -6
- package/src/components/xt-button/style/index.scss +7 -5
- package/src/components/xt-card/index.vue +3 -3
- package/src/components/xt-card-item/index.vue +2 -2
- package/src/components/xt-chart/XtMulti.vue +8 -18
- package/src/components/xt-chart/XtPie.vue +1 -0
- package/src/components/xt-chart/utils.js +84 -50
- package/src/components/xt-config-provider/index.vue +56 -54
- package/src/components/xt-config-provider/style/index.scss +0 -11
- package/src/components/xt-date-picker/component/RangeDate.vue +1 -29
- package/src/components/xt-date-picker/style/index.scss +79 -54
- package/src/components/xt-flow/flowable-parser.js +244 -0
- package/src/components/xt-flow/index.js +8 -0
- package/src/components/xt-flow/index.vue +226 -0
- package/src/components/xt-flow/style/index.scss +359 -0
- package/src/components/xt-list/index.vue +23 -12
- package/src/components/xt-scroll/index.js +9 -0
- package/src/components/xt-scroll/index.vue +363 -0
- package/src/components/xt-scroll/style/index.scss +107 -0
- package/src/components/xt-scroll-arrow/index.vue +200 -83
- package/src/components/xt-scroll-arrow/style/index.scss +16 -5
- package/src/components/xt-text/style/index.scss +6 -6
- package/src/index.js +15 -13
- package/src/styles/css-variables.scss +73 -1
- package/src/utils/color.js +105 -0
- package/src/utils/index.js +456 -468
- package/src/utils/theme-vars.js +134 -0
- package/lib/css/1.87a493be.css +0 -1
- package/lib/xt-date-picker/css/1.87a493be.css +0 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
## iframe 主题注入
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
|
|
5
|
+
为微前端架构提供统一的主题管理方案。主系统切换主题后,子系统 iframe 中的 Element UI 组件会自动同步换色,子系统无需任何改造。
|
|
6
|
+
|
|
7
|
+
### 设计思路
|
|
8
|
+
|
|
9
|
+
| 角色 | 职责 |
|
|
10
|
+
|------|------|
|
|
11
|
+
| 主系统 | 统一管理主题状态,注入 CSS 变量到 iframe |
|
|
12
|
+
| 子系统 | 标准 Element UI 项目,无需改造 |
|
|
13
|
+
| 注入时机 | iframe 加载完成后自动注入 |
|
|
14
|
+
|
|
15
|
+
### 工作流程
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
1. 主系统调用 setTheme('dark')
|
|
19
|
+
↓
|
|
20
|
+
2. utils 同步更新 --el-* + --xt-* 变量到主文档
|
|
21
|
+
↓
|
|
22
|
+
3. utils 通过 onConfigChange 广播主题变更
|
|
23
|
+
↓
|
|
24
|
+
4. 所有 IframeThemeInjector 实例收到通知
|
|
25
|
+
↓
|
|
26
|
+
5. 实例通过 applyThemeVars 将新主题应用到管理的 iframe
|
|
27
|
+
↓
|
|
28
|
+
6. 所有 iframe 内的 Element UI 组件实时换色
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 快速开始
|
|
32
|
+
|
|
33
|
+
### JS 模块(CSS 已内联为字符串)
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import { createThemeInjector } from 'xt-element-ui'
|
|
37
|
+
|
|
38
|
+
// 创建注入器(CSS 已内联,无需手动提供)
|
|
39
|
+
const injector = createThemeInjector({ theme: 'white' })
|
|
40
|
+
|
|
41
|
+
// 注入所有 iframe
|
|
42
|
+
injector.injectAll('iframe')
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 直接引用 CSS 文件
|
|
46
|
+
|
|
47
|
+
如果使用独立 CSS 文件注入:
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<link rel="stylesheet" href="xt-element-ui/lib/theme/element-vars.css">
|
|
51
|
+
<link rel="stylesheet" href="xt-element-ui/lib/theme/element-overrides.css">
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 手动注入 iframe(使用独立 CSS 文件)
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
// 动态加载并注入
|
|
58
|
+
fetch('/lib/theme/element-vars.css')
|
|
59
|
+
.then(res => res.text())
|
|
60
|
+
.then(css => {
|
|
61
|
+
const style = document.createElement('style')
|
|
62
|
+
style.textContent = css
|
|
63
|
+
iframe.contentDocument.head.appendChild(style)
|
|
64
|
+
})
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## API 说明
|
|
68
|
+
|
|
69
|
+
### createThemeInjector(options)
|
|
70
|
+
|
|
71
|
+
创建一个预配置的主题注入器实例。
|
|
72
|
+
|
|
73
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
74
|
+
|------|------|------|------|
|
|
75
|
+
| `options.theme` | String | 否 | 初始主题:`white`、`dark`(默认 `white`) |
|
|
76
|
+
| `options.primaryColor` | String | 否 | 初始主色调(默认 `#1890ff`) |
|
|
77
|
+
| `options.brand` | String | 否 | 品牌标识:`''`、`water`、`electricity`、`gas` |
|
|
78
|
+
| `options.persist` | Boolean | 否 | 是否持久化到 localStorage(默认 `false`) |
|
|
79
|
+
| `options.onThemeChange` | Function | 否 | 主题变化回调 |
|
|
80
|
+
|
|
81
|
+
**返回值**:`IframeThemeInjector` 实例
|
|
82
|
+
|
|
83
|
+
### inject(iframe)
|
|
84
|
+
|
|
85
|
+
向指定 iframe 注入主题 CSS。
|
|
86
|
+
|
|
87
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
88
|
+
|------|------|------|------|
|
|
89
|
+
| `iframe` | HTMLIFrameElement | 是 | iframe 元素 |
|
|
90
|
+
|
|
91
|
+
**返回值**:`boolean` 是否注入成功
|
|
92
|
+
|
|
93
|
+
### injectAll(selector)
|
|
94
|
+
|
|
95
|
+
批量注入所有匹配选择器的 iframe。
|
|
96
|
+
|
|
97
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
98
|
+
|------|------|------|------|
|
|
99
|
+
| `selector` | String | 否 | CSS 选择器(默认 `'iframe'`) |
|
|
100
|
+
|
|
101
|
+
**返回值**:`number` 成功注入的数量
|
|
102
|
+
|
|
103
|
+
### setTheme(theme, options)
|
|
104
|
+
|
|
105
|
+
切换主题,自动同步到主文档和所有 iframe。
|
|
106
|
+
|
|
107
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
108
|
+
|------|------|------|------|
|
|
109
|
+
| `theme` | String | 是 | `white`、`dark` |
|
|
110
|
+
| `options.primaryColor` | String | 否 | 同时设置主色调 |
|
|
111
|
+
| `options.brand` | String | 否 | 同时设置品牌色 |
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
const injector = createThemeInjector({ theme: 'white' })
|
|
115
|
+
injector.injectAll('iframe')
|
|
116
|
+
|
|
117
|
+
// 切换主题(自动同步主文档 + 所有 iframe)
|
|
118
|
+
injector.setTheme('dark')
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### setPrimaryColor(color)
|
|
122
|
+
|
|
123
|
+
设置主色调,自动同步到主文档和所有 iframe。
|
|
124
|
+
|
|
125
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
126
|
+
|------|------|------|------|
|
|
127
|
+
| `color` | String | 是 | 十六进制颜色值 |
|
|
128
|
+
|
|
129
|
+
### setBrand(brand)
|
|
130
|
+
|
|
131
|
+
设置品牌色,切换对应品牌的主色调。
|
|
132
|
+
|
|
133
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
134
|
+
|------|------|------|------|
|
|
135
|
+
| `brand` | String | 是 | `''`、`water`、`electricity`、`gas` |
|
|
136
|
+
|
|
137
|
+
**品牌色映射**:
|
|
138
|
+
|
|
139
|
+
| 品牌 | 亮色 | 暗色 |
|
|
140
|
+
|------|------|------|
|
|
141
|
+
| `water` | `#0077be` | `#0099cc` |
|
|
142
|
+
| `electricity` | `#2ecc71` | `#27ae60` |
|
|
143
|
+
| `gas` | `#f39c12` | `#e67e22` |
|
|
144
|
+
|
|
145
|
+
### startObserving(target)
|
|
146
|
+
|
|
147
|
+
开始自动监听 DOM 变化,自动注入新添加的 iframe。
|
|
148
|
+
|
|
149
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
150
|
+
|------|------|------|------|
|
|
151
|
+
| `target` | HTMLElement | 否 | 监听容器(默认 `document.body`) |
|
|
152
|
+
|
|
153
|
+
### stopObserving()
|
|
154
|
+
|
|
155
|
+
停止自动监听。
|
|
156
|
+
|
|
157
|
+
### remove(iframe)
|
|
158
|
+
|
|
159
|
+
移除指定 iframe 的注入。
|
|
160
|
+
|
|
161
|
+
### removeAll()
|
|
162
|
+
|
|
163
|
+
移除所有 iframe 的注入。
|
|
164
|
+
|
|
165
|
+
### destroy()
|
|
166
|
+
|
|
167
|
+
销毁实例,清理所有资源。
|
|
168
|
+
|
|
169
|
+
## 使用示例
|
|
170
|
+
|
|
171
|
+
### 基本用法
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
import { createThemeInjector } from 'xt-element-ui'
|
|
175
|
+
|
|
176
|
+
// 创建注入器
|
|
177
|
+
const injector = createThemeInjector({ theme: 'white' })
|
|
178
|
+
|
|
179
|
+
// 注入现有 iframe
|
|
180
|
+
injector.injectAll('iframe')
|
|
181
|
+
|
|
182
|
+
// 切换主题
|
|
183
|
+
injector.setTheme('dark')
|
|
184
|
+
|
|
185
|
+
// 设置品牌色
|
|
186
|
+
injector.setBrand('water')
|
|
187
|
+
|
|
188
|
+
// 销毁
|
|
189
|
+
injector.destroy()
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 与全局主题配置联动
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
import { setTheme, onConfigChange } from 'xt-element-ui'
|
|
196
|
+
import { createThemeInjector } from 'xt-element-ui'
|
|
197
|
+
|
|
198
|
+
// 1. 创建注入器
|
|
199
|
+
const injector = createThemeInjector({ theme: 'white' })
|
|
200
|
+
|
|
201
|
+
// 2. 注入 iframe
|
|
202
|
+
injector.injectAll('iframe')
|
|
203
|
+
|
|
204
|
+
// 3. 监听全局主题变化(保持同步)
|
|
205
|
+
const unsubscribe = onConfigChange((key, value) => {
|
|
206
|
+
if (key === 'theme') {
|
|
207
|
+
console.log('主题变更:', value)
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
// 4. 通过全局 API 切换主题(自动同步到 iframe)
|
|
212
|
+
setTheme('dark')
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 自动监听新增 iframe
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
const injector = createThemeInjector({ theme: 'white' })
|
|
219
|
+
injector.startObserving() // 自动监听 DOM
|
|
220
|
+
|
|
221
|
+
// 动态添加的 iframe 会自动被注入主题
|
|
222
|
+
const newIframe = document.createElement('iframe')
|
|
223
|
+
document.body.appendChild(newIframe) // 自动注入
|
|
224
|
+
|
|
225
|
+
// 清理
|
|
226
|
+
injector.stopObserving()
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### 持久化配置
|
|
230
|
+
|
|
231
|
+
```javascript
|
|
232
|
+
// 创建时启用持久化
|
|
233
|
+
const injector = createThemeInjector({
|
|
234
|
+
theme: 'white',
|
|
235
|
+
persist: true // 保存到 localStorage
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
// 下次加载时自动恢复
|
|
239
|
+
// localStorage 中的配置会自动应用
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## 注意事项
|
|
243
|
+
|
|
244
|
+
1. **跨域限制**:跨域 iframe 无法访问,将输出警告日志
|
|
245
|
+
2. **加载时机**:iframe 必须加载完成后才能注入(注入器会自动等待 `load` 事件)
|
|
246
|
+
3. **CSS 内联**:推荐使用 `createThemeInjector()`,CSS 已内联无需额外配置
|
|
247
|
+
4. **主题同步**:通过 `onConfigChange` 实现主文档和 iframe 的主题自动同步
|
|
248
|
+
5. **性能**:大量 iframe 场景建议使用 `startObserving` 自动管理,避免手动注入遗漏
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
| `plain` | Boolean | false | - | 是否为朴素按钮 |
|
|
19
19
|
| `disabled` | Boolean | false | - | 是否禁用按钮 |
|
|
20
20
|
| `round` | Boolean | false | - | 是否为圆角按钮 |
|
|
21
|
+
| `square` | Boolean | false | - | 是否为正方形按钮 |
|
|
22
|
+
| `circle` | Boolean | false | - | 是否为圆形按钮 |
|
|
23
|
+
|
|
21
24
|
|
|
22
25
|
## 事件说明
|
|
23
26
|
|
|
@@ -31,11 +34,13 @@
|
|
|
31
34
|
::: demo 不同类型的按钮
|
|
32
35
|
```vue
|
|
33
36
|
<template>
|
|
34
|
-
<div style="display: flex; gap: 12px;">
|
|
37
|
+
<div style="display: inline-flex; gap: 12px;">
|
|
38
|
+
<XtButton>默认按钮</XtButton>
|
|
35
39
|
<XtButton type="primary">主要按钮</XtButton>
|
|
36
40
|
<XtButton type="success">成功按钮</XtButton>
|
|
37
41
|
<XtButton type="warning">警告按钮</XtButton>
|
|
38
42
|
<XtButton type="danger">危险按钮</XtButton>
|
|
43
|
+
<XtButton type="info">信息按钮</XtButton>
|
|
39
44
|
</div>
|
|
40
45
|
</template>
|
|
41
46
|
```
|
|
@@ -45,7 +50,7 @@
|
|
|
45
50
|
::: demo 不同尺寸的按钮
|
|
46
51
|
```vue
|
|
47
52
|
<template>
|
|
48
|
-
<div style="display: flex; gap: 12px; align-items: center;">
|
|
53
|
+
<div style="display: inline-flex; gap: 12px; align-items: center;">
|
|
49
54
|
<XtButton size="large">大号按钮</XtButton>
|
|
50
55
|
<XtButton>默认按钮</XtButton>
|
|
51
56
|
<XtButton size="small">小号按钮</XtButton>
|
|
@@ -59,7 +64,7 @@
|
|
|
59
64
|
::: demo 朴素按钮
|
|
60
65
|
```vue
|
|
61
66
|
<template>
|
|
62
|
-
<div style="display: flex; gap: 12px;">
|
|
67
|
+
<div style="display: inline-flex; gap: 12px;">
|
|
63
68
|
<XtButton type="primary" plain>朴素主按钮</XtButton>
|
|
64
69
|
<XtButton type="success" plain>朴素成功按钮</XtButton>
|
|
65
70
|
<XtButton type="warning" plain>朴素警告按钮</XtButton>
|
|
@@ -73,11 +78,13 @@
|
|
|
73
78
|
::: demo 状态按钮
|
|
74
79
|
```vue
|
|
75
80
|
<template>
|
|
76
|
-
<div style="display: flex; gap: 12px;">
|
|
81
|
+
<div style="display: inline-flex; gap: 12px;">
|
|
77
82
|
<XtButton disabled>禁用按钮</XtButton>
|
|
78
83
|
<XtButton round>圆角按钮</XtButton>
|
|
79
84
|
<XtButton type="primary" disabled>禁用主按钮</XtButton>
|
|
80
85
|
<XtButton type="primary" round>圆角主按钮</XtButton>
|
|
86
|
+
<XtButton type="success" icon="el-icon-plus" circle></XtButton>
|
|
87
|
+
<XtButton type="success" icon="el-icon-plus" square></XtButton>
|
|
81
88
|
</div>
|
|
82
89
|
</template>
|
|
83
90
|
```
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
::: demo 基本用法
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
|
-
<XtCard title="卡片标题"
|
|
8
|
+
<XtCard title="卡片标题"></XtCard>
|
|
9
9
|
</template>
|
|
10
10
|
```
|
|
11
11
|
:::
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
::: demo 基础卡片
|
|
18
18
|
```vue
|
|
19
19
|
<template>
|
|
20
|
-
<XtCard title="今日销售额"
|
|
20
|
+
<XtCard title="今日销售额"></XtCard>
|
|
21
21
|
</template>
|
|
22
22
|
```
|
|
23
23
|
:::
|
|
@@ -49,12 +49,10 @@
|
|
|
49
49
|
```vue
|
|
50
50
|
<template>
|
|
51
51
|
<XtCard>
|
|
52
|
-
<template
|
|
52
|
+
<template v-slot:title>
|
|
53
53
|
<span style="color: #1890ff;">📊 数据分析</span>
|
|
54
54
|
</template>
|
|
55
|
-
<
|
|
56
|
-
<span style="font-size: 32px; color: #52c41a;">98.5%</span>
|
|
57
|
-
</template>
|
|
55
|
+
<span style="font-size: 32px; color: #52c41a;">98.5%</span>
|
|
58
56
|
</XtCard>
|
|
59
57
|
</template>
|
|
60
58
|
```
|
|
@@ -93,14 +91,10 @@
|
|
|
93
91
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
94
92
|
|------|------|--------|------|
|
|
95
93
|
| `title` | String | - | 卡片标题 |
|
|
96
|
-
| `value` | String / Number | - | 卡片数值 |
|
|
97
|
-
| `unit` | String | - | 数值单位 |
|
|
98
|
-
| `noPadding` | Boolean | false | 是否取消内边距 |
|
|
99
94
|
|
|
100
95
|
## 插槽说明
|
|
101
96
|
|
|
102
97
|
| 插槽名 | 说明 |
|
|
103
98
|
|--------|------|
|
|
104
99
|
| `default` | 自定义内容区域 |
|
|
105
|
-
| `
|
|
106
|
-
| `value` | 自定义数值区域 |
|
|
100
|
+
| `header` | 自定义头部区域 |
|
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
<XtConfigProvider
|
|
128
128
|
:primaryColor="primaryColor"
|
|
129
129
|
:theme="currentTheme"
|
|
130
|
+
:brand="brand"
|
|
130
131
|
injectBackground
|
|
131
132
|
>
|
|
132
133
|
<div style="min-height: 120px; padding: 16px;">
|
|
@@ -160,6 +161,7 @@
|
|
|
160
161
|
export default {
|
|
161
162
|
data() {
|
|
162
163
|
return {
|
|
164
|
+
brand: 'water',
|
|
163
165
|
primaryColor: '#1890ff',
|
|
164
166
|
currentTheme: 'light',
|
|
165
167
|
colors: ['#1890ff', '#52c41a', '#faad14', '#f5222d', '#722ed1']
|