@mc-markets/ui 1.0.35 → 1.0.38
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 +0 -614
- package/dist/index.js +38 -3
- package/dist/ui.css +1 -0
- package/package.json +19 -47
- package/packages/styles/README.md +0 -150
- package/packages/styles/element/form.scss +21 -0
- package/packages/styles/element/popper.scss +6 -0
- package/packages/styles/element/select.scss +35 -0
- package/packages/styles/index.scss +6 -4
- package/packages/styles/{theme-config.ts → theme-config.js} +35 -79
- package/packages/styles/variables.scss +75 -79
- package/USAGE.md +0 -383
- package/dist/packages/components/Alert/Alert.vue.d.ts +0 -18
- package/dist/packages/components/Alert/index.d.ts +0 -3
- package/dist/packages/components/Banner/Banner.vue.d.ts +0 -18
- package/dist/packages/components/Banner/index.d.ts +0 -3
- package/dist/packages/components/DatePicker/DatePicker.vue.d.ts +0 -17
- package/dist/packages/components/DatePicker/index.d.ts +0 -3
- package/dist/packages/components/Dialog/index.vue.d.ts +0 -51
- package/dist/packages/components/Empty/Empty.vue.d.ts +0 -19
- package/dist/packages/components/Empty/index.d.ts +0 -3
- package/dist/packages/components/Icon/index.d.ts +0 -3
- package/dist/packages/components/Icon/types.d.ts +0 -35
- package/dist/packages/components/Notification/Notification.vue.d.ts +0 -18
- package/dist/packages/components/Notification/index.d.ts +0 -3
- package/dist/packages/components/Pagination/Pagination.vue.d.ts +0 -17
- package/dist/packages/components/Pagination/index.d.ts +0 -3
- package/dist/packages/components/Tab/Tab.vue.d.ts +0 -17
- package/dist/packages/components/Tab/TabPane.vue.d.ts +0 -18
- package/dist/packages/components/Tooltips/Tooltips.vue.d.ts +0 -18
- package/dist/packages/components/Tooltips/index.d.ts +0 -3
- package/dist/packages/index.d.ts +0 -23
- package/dist/packages/styles/theme-config.d.ts +0 -85
- package/dist/src/main.d.ts +0 -0
- package/dist/src/utils/theme.d.ts +0 -66
- package/dist/style.css +0 -1
- package/dist/vite.config.d.ts +0 -2
|
@@ -6,9 +6,76 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
// 导入所有 Element Plus 样式
|
|
9
|
+
// 自定义 Element Plus 变量
|
|
10
|
+
@forward 'element-plus/theme-chalk/src/common/var.scss' with (
|
|
11
|
+
// 自定义颜色变量
|
|
12
|
+
$colors: (
|
|
13
|
+
'primary': (
|
|
14
|
+
'base': #FFD905,
|
|
15
|
+
),
|
|
16
|
+
'success': (
|
|
17
|
+
'base': #34A88B ,
|
|
18
|
+
),
|
|
19
|
+
'warning': (
|
|
20
|
+
'base': #FFA61F,
|
|
21
|
+
),
|
|
22
|
+
'danger': (
|
|
23
|
+
'base': #f14654,
|
|
24
|
+
),
|
|
25
|
+
'info': (
|
|
26
|
+
'base': #585660,
|
|
27
|
+
),
|
|
28
|
+
),
|
|
29
|
+
$text-color: (
|
|
30
|
+
'primary': #303133,
|
|
31
|
+
'regular': red,
|
|
32
|
+
'secondary': #909399,
|
|
33
|
+
'placeholder': #C0C4CC,
|
|
34
|
+
),
|
|
35
|
+
// 自定义字体大小
|
|
36
|
+
$font-size: (
|
|
37
|
+
'extra-large': 20px,
|
|
38
|
+
'large': 18px,
|
|
39
|
+
'medium': 16px,
|
|
40
|
+
'base': 14px,
|
|
41
|
+
'small': 12px,
|
|
42
|
+
'extra-small': 10px,
|
|
43
|
+
),
|
|
44
|
+
// 自定义圆角
|
|
45
|
+
$border-radius: (
|
|
46
|
+
'base': 8px,
|
|
47
|
+
'small': 4px,
|
|
48
|
+
'round': 20px,
|
|
49
|
+
'circle': 100%,
|
|
50
|
+
),
|
|
51
|
+
$border-color-hover:var(--text-brand),
|
|
52
|
+
// 自定义阴影
|
|
53
|
+
$box-shadow: (
|
|
54
|
+
'base': (
|
|
55
|
+
0 2px 4px rgba(0, 0, 0, 0.12),
|
|
56
|
+
0 0 6px rgba(0, 0, 0, 0.04)
|
|
57
|
+
),
|
|
58
|
+
'light': (
|
|
59
|
+
0 2px 12px 0 rgba(0, 0, 0, 0.1)
|
|
60
|
+
),
|
|
61
|
+
'lighter': (
|
|
62
|
+
0 2px 12px 0 rgba(0, 0, 0, 0.06)
|
|
63
|
+
),
|
|
64
|
+
'dark': (
|
|
65
|
+
0 2px 4px rgba(0, 0, 0, 0.12),
|
|
66
|
+
0 0 6px rgba(0, 0, 0, 0.12)
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
$common-component-size: (
|
|
70
|
+
'large': 40px,
|
|
71
|
+
'default': 48px,
|
|
72
|
+
'small': 40px,
|
|
73
|
+
)
|
|
74
|
+
);
|
|
9
75
|
@use "element-plus/theme-chalk/src/index.scss" as *;
|
|
10
76
|
@use 'element-plus/theme-chalk/src/dark/css-vars.scss';
|
|
11
77
|
|
|
78
|
+
|
|
12
79
|
// 导入项目变量
|
|
13
80
|
@use './variables/border-mode.css';
|
|
14
81
|
@use './variables/color-modes-dark.css';
|
|
@@ -17,83 +84,12 @@
|
|
|
17
84
|
@use './variables/spacing-mode.css';
|
|
18
85
|
@use './variables/typography-desktop.css';
|
|
19
86
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
--el-color
|
|
24
|
-
--el-color-
|
|
25
|
-
--el-
|
|
26
|
-
|
|
27
|
-
--el-color-
|
|
28
|
-
--el-color-primary-light-9: #FFF9D9;
|
|
29
|
-
--el-color-primary-dark-2: #E6C300;
|
|
30
|
-
|
|
31
|
-
// 成功色
|
|
32
|
-
--el-color-success: #34A88B;
|
|
33
|
-
--el-color-success-light-3: #5BB89E;
|
|
34
|
-
--el-color-success-light-5: #7CC7B1;
|
|
35
|
-
--el-color-success-light-7: #9DD6C4;
|
|
36
|
-
--el-color-success-light-8: #B3E0D2;
|
|
37
|
-
--el-color-success-light-9: #D9F0E8;
|
|
38
|
-
--el-color-success-dark-2: #2A8A73;
|
|
39
|
-
|
|
40
|
-
// 警告色
|
|
41
|
-
--el-color-warning: #FFA61F;
|
|
42
|
-
--el-color-warning-light-3: #FFB84D;
|
|
43
|
-
--el-color-warning-light-5: #FFC973;
|
|
44
|
-
--el-color-warning-light-7: #FFD999;
|
|
45
|
-
--el-color-warning-light-8: #FFE2B3;
|
|
46
|
-
--el-color-warning-light-9: #FFF0D9;
|
|
47
|
-
--el-color-warning-dark-2: #E6940C;
|
|
48
|
-
|
|
49
|
-
// 危险色
|
|
50
|
-
--el-color-danger: #f14654;
|
|
51
|
-
--el-color-danger-light-3: #F46B77;
|
|
52
|
-
--el-color-danger-light-5: #F78A94;
|
|
53
|
-
--el-color-danger-light-7: #FAA9B1;
|
|
54
|
-
--el-color-danger-light-8: #FBC2C8;
|
|
55
|
-
--el-color-danger-light-9: #FDE0E3;
|
|
56
|
-
--el-color-danger-dark-2: #D63A47;
|
|
57
|
-
|
|
58
|
-
// 信息色
|
|
59
|
-
--el-color-info: #585660;
|
|
60
|
-
--el-color-info-light-3: #7A7A82;
|
|
61
|
-
--el-color-info-light-5: #96969C;
|
|
62
|
-
--el-color-info-light-7: #B2B2B6;
|
|
63
|
-
--el-color-info-light-8: #C6C6C9;
|
|
64
|
-
--el-color-info-light-9: #E0E0E2;
|
|
65
|
-
--el-color-info-dark-2: #46464E;
|
|
66
|
-
|
|
67
|
-
// 字体大小
|
|
68
|
-
--el-font-size-extra-large: 20px;
|
|
69
|
-
--el-font-size-large: 18px;
|
|
70
|
-
--el-font-size-medium: 16px;
|
|
71
|
-
--el-font-size-base: 14px;
|
|
72
|
-
--el-font-size-small: 12px;
|
|
73
|
-
--el-font-size-extra-small: 10px;
|
|
74
|
-
|
|
75
|
-
// 圆角
|
|
76
|
-
--el-border-radius-base: 8px;
|
|
77
|
-
--el-border-radius-small: 4px;
|
|
78
|
-
--el-border-radius-round: 20px;
|
|
79
|
-
--el-border-radius-circle: 100%;
|
|
80
|
-
|
|
81
|
-
// 间距
|
|
82
|
-
--el-spacing-base: 16px;
|
|
83
|
-
--el-spacing-small: 8px;
|
|
84
|
-
--el-spacing-large: 24px;
|
|
85
|
-
|
|
86
|
-
// 阴影
|
|
87
|
-
--el-box-shadow-base: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
|
|
88
|
-
--el-box-shadow-light: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
89
|
-
--el-box-shadow-dark: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
|
|
90
|
-
|
|
91
|
-
// 过渡动画
|
|
92
|
-
--el-transition-base: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
93
|
-
--el-transition-fade: opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1);
|
|
94
|
-
--el-transition-md-fade: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1);
|
|
95
|
-
--el-transition-fade-linear: opacity 0.2s linear;
|
|
96
|
-
--el-transition-border: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
97
|
-
--el-transition-box-shadow: box-shadow 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
98
|
-
--el-transition-color: color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
87
|
+
|
|
88
|
+
html.dark{
|
|
89
|
+
--el-text-color-regular: var(--text-white);
|
|
90
|
+
--el-disabled-border-color:rgba(255, 255, 255, 0);
|
|
91
|
+
--el-border-color-light:var(--border-primary);
|
|
92
|
+
--el-popover-border-radius:8px;
|
|
93
|
+
|
|
94
|
+
--el-text-color-placeholder:var(--text-tertiary);
|
|
99
95
|
}
|
package/USAGE.md
DELETED
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
# @mc-markets/ui 使用指南
|
|
2
|
-
|
|
3
|
-
这是一个完整的 Element Plus 导出包,提供了 Element Plus 的所有功能,包括组件、指令、服务、样式、主题和国际化支持。
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @mc-markets/ui
|
|
9
|
-
# 或
|
|
10
|
-
yarn add @mc-markets/ui
|
|
11
|
-
# 或
|
|
12
|
-
pnpm add @mc-markets/ui
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## 基础使用
|
|
16
|
-
|
|
17
|
-
### 1. 完整导入(推荐)
|
|
18
|
-
|
|
19
|
-
```typescript
|
|
20
|
-
import { createApp } from 'vue'
|
|
21
|
-
import McMarketsUI from '@mc-markets/ui'
|
|
22
|
-
import '@mc-markets/ui/style' // 导入样式
|
|
23
|
-
|
|
24
|
-
const app = createApp(App)
|
|
25
|
-
|
|
26
|
-
// 使用默认配置
|
|
27
|
-
app.use(McMarketsUI)
|
|
28
|
-
|
|
29
|
-
// 或使用自定义配置
|
|
30
|
-
app.use(McMarketsUI, {
|
|
31
|
-
locale: 'zh-cn', // 默认语言
|
|
32
|
-
theme: {
|
|
33
|
-
name: 'custom',
|
|
34
|
-
dark: false,
|
|
35
|
-
cssVars: {
|
|
36
|
-
'--el-color-primary': '#409eff',
|
|
37
|
-
'--el-color-success': '#67c23a'
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
importStyle: true // 是否自动导入样式
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
app.mount('#app')
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### 2. 按需导入
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
import { createApp } from 'vue'
|
|
50
|
-
import { ElButton, ElInput, ElForm, ElFormItem } from '@mc-markets/ui'
|
|
51
|
-
import '@mc-markets/ui/style'
|
|
52
|
-
|
|
53
|
-
const app = createApp(App)
|
|
54
|
-
|
|
55
|
-
// 手动注册组件
|
|
56
|
-
app.component('ElButton', ElButton)
|
|
57
|
-
app.component('ElInput', ElInput)
|
|
58
|
-
app.component('ElForm', ElForm)
|
|
59
|
-
app.component('ElFormItem', ElFormItem)
|
|
60
|
-
|
|
61
|
-
app.mount('#app')
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## 国际化支持
|
|
65
|
-
|
|
66
|
-
### 1. 使用内置语言包
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
import { createApp } from 'vue'
|
|
70
|
-
import McMarketsUI, { locales, getLocale } from '@mc-markets/ui'
|
|
71
|
-
|
|
72
|
-
const app = createApp(App)
|
|
73
|
-
|
|
74
|
-
// 使用中文
|
|
75
|
-
app.use(McMarketsUI, {
|
|
76
|
-
locale: 'zh-cn'
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
// 使用英文
|
|
80
|
-
app.use(McMarketsUI, {
|
|
81
|
-
locale: 'en'
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
// 动态切换语言
|
|
85
|
-
const switchToEnglish = () => {
|
|
86
|
-
const locale = getLocale('en')
|
|
87
|
-
// 重新配置 Element Plus
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### 2. 支持的语言列表
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
import { supportedLocales } from '@mc-markets/ui'
|
|
95
|
-
|
|
96
|
-
console.log(supportedLocales)
|
|
97
|
-
// ['zh-cn', 'en', 'zh-tw', 'ja', 'ko', 'es', 'fr', 'de', ...]
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## 主题定制
|
|
101
|
-
|
|
102
|
-
### 1. 使用主题管理器
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
import { themeManager } from '@mc-markets/ui'
|
|
106
|
-
|
|
107
|
-
// 设置主题
|
|
108
|
-
themeManager.setTheme({
|
|
109
|
-
name: 'custom',
|
|
110
|
-
dark: false,
|
|
111
|
-
cssVars: {
|
|
112
|
-
'--el-color-primary': '#409eff',
|
|
113
|
-
'--el-color-success': '#67c23a',
|
|
114
|
-
'--el-color-warning': '#e6a23c',
|
|
115
|
-
'--el-color-danger': '#f56c6c',
|
|
116
|
-
'--el-color-info': '#909399'
|
|
117
|
-
},
|
|
118
|
-
customClass: 'my-custom-theme'
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
// 切换暗色主题
|
|
122
|
-
themeManager.toggleDark()
|
|
123
|
-
|
|
124
|
-
// 获取当前主题
|
|
125
|
-
const currentTheme = themeManager.getTheme()
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### 2. 在组件中使用
|
|
129
|
-
|
|
130
|
-
```vue
|
|
131
|
-
<template>
|
|
132
|
-
<div>
|
|
133
|
-
<el-button @click="toggleTheme">切换主题</el-button>
|
|
134
|
-
<el-button @click="setCustomTheme">设置自定义主题</el-button>
|
|
135
|
-
</div>
|
|
136
|
-
</template>
|
|
137
|
-
|
|
138
|
-
<script setup>
|
|
139
|
-
import { themeManager } from '@mc-markets/ui'
|
|
140
|
-
|
|
141
|
-
const toggleTheme = () => {
|
|
142
|
-
themeManager.toggleDark()
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const setCustomTheme = () => {
|
|
146
|
-
themeManager.setTheme({
|
|
147
|
-
name: 'blue',
|
|
148
|
-
cssVars: {
|
|
149
|
-
'--el-color-primary': '#1890ff'
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
}
|
|
153
|
-
</script>
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## 样式覆盖和主题配置
|
|
157
|
-
|
|
158
|
-
### 1. 使用 CSS 变量(推荐)
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
import { createApp } from 'vue'
|
|
162
|
-
import McMarketsUI from '@mc-markets/ui'
|
|
163
|
-
import '@mc-markets/ui/scss-variables' // 导入SCSS变量
|
|
164
|
-
|
|
165
|
-
const app = createApp(App)
|
|
166
|
-
app.use(McMarketsUI)
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
```css
|
|
170
|
-
/* 在你的 CSS 文件中 */
|
|
171
|
-
:root {
|
|
172
|
-
--el-color-primary: #409eff;
|
|
173
|
-
--el-color-success: #67c23a;
|
|
174
|
-
--el-color-warning: #e6a23c;
|
|
175
|
-
--el-color-danger: #f56c6c;
|
|
176
|
-
--el-color-info: #909399;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/* 暗色主题 */
|
|
180
|
-
.dark {
|
|
181
|
-
--el-color-primary: #409eff;
|
|
182
|
-
--el-color-success: #67c23a;
|
|
183
|
-
--el-color-warning: #e6a23c;
|
|
184
|
-
--el-color-danger: #f56c6c;
|
|
185
|
-
--el-color-info: #909399;
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### 2. 使用 SCSS 变量
|
|
190
|
-
|
|
191
|
-
```scss
|
|
192
|
-
// 在你的 SCSS 文件中
|
|
193
|
-
@use '@mc-markets/ui/scss-variables' as *;
|
|
194
|
-
|
|
195
|
-
// 或者自定义变量
|
|
196
|
-
@forward 'element-plus/theme-chalk/src/common/var.scss' with (
|
|
197
|
-
$colors: (
|
|
198
|
-
'primary': (
|
|
199
|
-
'base': #409eff,
|
|
200
|
-
),
|
|
201
|
-
'success': (
|
|
202
|
-
'base': #67c23a,
|
|
203
|
-
),
|
|
204
|
-
)
|
|
205
|
-
);
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### 3. JavaScript 动态配置
|
|
209
|
-
|
|
210
|
-
```typescript
|
|
211
|
-
import {
|
|
212
|
-
setTheme,
|
|
213
|
-
setPrimaryColor,
|
|
214
|
-
toggleDark,
|
|
215
|
-
themeConfigManager
|
|
216
|
-
} from '@mc-markets/ui'
|
|
217
|
-
|
|
218
|
-
// 设置主题
|
|
219
|
-
setTheme({
|
|
220
|
-
name: 'custom',
|
|
221
|
-
dark: false,
|
|
222
|
-
primaryColor: '#1890ff',
|
|
223
|
-
successColor: '#52c41a',
|
|
224
|
-
warningColor: '#faad14',
|
|
225
|
-
dangerColor: '#ff4d4f',
|
|
226
|
-
infoColor: '#1890ff',
|
|
227
|
-
cssVars: {
|
|
228
|
-
'--el-border-radius-base': '6px',
|
|
229
|
-
'--el-font-size-base': '14px'
|
|
230
|
-
}
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
// 单独设置颜色
|
|
234
|
-
setPrimaryColor('#1890ff')
|
|
235
|
-
setSuccessColor('#52c41a')
|
|
236
|
-
setWarningColor('#faad14')
|
|
237
|
-
setDangerColor('#ff4d4f')
|
|
238
|
-
setInfoColor('#1890ff')
|
|
239
|
-
|
|
240
|
-
// 切换暗色主题
|
|
241
|
-
toggleDark()
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
## 高级用法
|
|
245
|
-
|
|
246
|
-
### 1. 自定义配置
|
|
247
|
-
|
|
248
|
-
```typescript
|
|
249
|
-
import { createApp } from 'vue'
|
|
250
|
-
import McMarketsUI, {
|
|
251
|
-
themeManager,
|
|
252
|
-
getLocale,
|
|
253
|
-
supportedLocales
|
|
254
|
-
} from '@mc-markets/ui'
|
|
255
|
-
|
|
256
|
-
const app = createApp(App)
|
|
257
|
-
|
|
258
|
-
// 自定义配置
|
|
259
|
-
app.use(McMarketsUI, {
|
|
260
|
-
locale: 'zh-cn',
|
|
261
|
-
theme: {
|
|
262
|
-
name: 'enterprise',
|
|
263
|
-
dark: false,
|
|
264
|
-
cssVars: {
|
|
265
|
-
'--el-color-primary': '#1890ff',
|
|
266
|
-
'--el-border-radius-base': '6px',
|
|
267
|
-
'--el-font-size-base': '14px'
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
importStyle: true
|
|
271
|
-
})
|
|
272
|
-
|
|
273
|
-
// 全局访问
|
|
274
|
-
app.config.globalProperties.$theme = themeManager
|
|
275
|
-
app.config.globalProperties.$locales = supportedLocales
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### 2. 在组合式 API 中使用
|
|
279
|
-
|
|
280
|
-
```vue
|
|
281
|
-
<template>
|
|
282
|
-
<div>
|
|
283
|
-
<el-button @click="changeLanguage">切换语言</el-button>
|
|
284
|
-
<el-button @click="changeTheme">切换主题</el-button>
|
|
285
|
-
</div>
|
|
286
|
-
</template>
|
|
287
|
-
|
|
288
|
-
<script setup>
|
|
289
|
-
import { ref } from 'vue'
|
|
290
|
-
import { themeManager, getLocale, supportedLocales } from '@mc-markets/ui'
|
|
291
|
-
|
|
292
|
-
const currentLocale = ref('zh-cn')
|
|
293
|
-
|
|
294
|
-
const changeLanguage = () => {
|
|
295
|
-
const currentIndex = supportedLocales.indexOf(currentLocale.value)
|
|
296
|
-
const nextIndex = (currentIndex + 1) % supportedLocales.length
|
|
297
|
-
currentLocale.value = supportedLocales[nextIndex]
|
|
298
|
-
|
|
299
|
-
// 重新配置语言
|
|
300
|
-
const locale = getLocale(currentLocale.value)
|
|
301
|
-
// 这里需要重新配置 Element Plus
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const changeTheme = () => {
|
|
305
|
-
themeManager.toggleDark()
|
|
306
|
-
}
|
|
307
|
-
</script>
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
## 类型支持
|
|
311
|
-
|
|
312
|
-
```typescript
|
|
313
|
-
import type {
|
|
314
|
-
ThemeConfig,
|
|
315
|
-
McMarketsUI
|
|
316
|
-
} from '@mc-markets/ui'
|
|
317
|
-
|
|
318
|
-
// 使用类型
|
|
319
|
-
const theme: ThemeConfig = {
|
|
320
|
-
name: 'custom',
|
|
321
|
-
dark: false,
|
|
322
|
-
cssVars: {
|
|
323
|
-
'--el-color-primary': '#409eff'
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
## 注意事项
|
|
329
|
-
|
|
330
|
-
1. **样式导入**:确保导入了 Element Plus 的样式文件
|
|
331
|
-
2. **语言包**:所有语言包都已内置,无需额外安装
|
|
332
|
-
3. **主题切换**:主题切换是全局的,会影响整个应用
|
|
333
|
-
4. **性能优化**:建议使用按需导入来减少包体积
|
|
334
|
-
5. **兼容性**:需要 Vue 3.3+ 和 Element Plus 2.8+
|
|
335
|
-
|
|
336
|
-
## 完整示例
|
|
337
|
-
|
|
338
|
-
```vue
|
|
339
|
-
<template>
|
|
340
|
-
<div class="app">
|
|
341
|
-
<el-header>
|
|
342
|
-
<el-menu mode="horizontal">
|
|
343
|
-
<el-menu-item index="1">首页</el-menu-item>
|
|
344
|
-
<el-menu-item index="2">关于</el-menu-item>
|
|
345
|
-
</el-menu>
|
|
346
|
-
</el-header>
|
|
347
|
-
|
|
348
|
-
<el-main>
|
|
349
|
-
<el-form :model="form" label-width="100px">
|
|
350
|
-
<el-form-item label="用户名">
|
|
351
|
-
<el-input v-model="form.username" />
|
|
352
|
-
</el-form-item>
|
|
353
|
-
<el-form-item label="密码">
|
|
354
|
-
<el-input v-model="form.password" type="password" />
|
|
355
|
-
</el-form-item>
|
|
356
|
-
<el-form-item>
|
|
357
|
-
<el-button type="primary" @click="submit">提交</el-button>
|
|
358
|
-
</el-form-item>
|
|
359
|
-
</el-form>
|
|
360
|
-
</el-main>
|
|
361
|
-
</div>
|
|
362
|
-
</template>
|
|
363
|
-
|
|
364
|
-
<script setup>
|
|
365
|
-
import { ref } from 'vue'
|
|
366
|
-
import { ElMessage } from '@mc-markets/ui'
|
|
367
|
-
|
|
368
|
-
const form = ref({
|
|
369
|
-
username: '',
|
|
370
|
-
password: ''
|
|
371
|
-
})
|
|
372
|
-
|
|
373
|
-
const submit = () => {
|
|
374
|
-
ElMessage.success('提交成功!')
|
|
375
|
-
}
|
|
376
|
-
</script>
|
|
377
|
-
|
|
378
|
-
<style>
|
|
379
|
-
@import '@mc-markets/ui/style';
|
|
380
|
-
</style>
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
这个包提供了 Element Plus 的完整功能,包括所有组件、指令、服务、样式、主题和国际化支持,让您可以轻松地在项目中使用 Element Plus 的所有功能。
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare function __VLS_template(): {
|
|
2
|
-
attrs: Partial<{}>;
|
|
3
|
-
slots: {
|
|
4
|
-
title?(_: {}): any;
|
|
5
|
-
default?(_: {}): any;
|
|
6
|
-
};
|
|
7
|
-
refs: {};
|
|
8
|
-
rootEl: any;
|
|
9
|
-
};
|
|
10
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
-
declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
12
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
13
|
-
export default _default;
|
|
14
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
|
-
new (): {
|
|
16
|
-
$slots: S;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare function __VLS_template(): {
|
|
2
|
-
attrs: Partial<{}>;
|
|
3
|
-
slots: {
|
|
4
|
-
title?(_: {}): any;
|
|
5
|
-
default?(_: {}): any;
|
|
6
|
-
};
|
|
7
|
-
refs: {};
|
|
8
|
-
rootEl: any;
|
|
9
|
-
};
|
|
10
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
-
declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
12
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
13
|
-
export default _default;
|
|
14
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
|
-
new (): {
|
|
16
|
-
$slots: S;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare function __VLS_template(): {
|
|
2
|
-
attrs: Partial<{}>;
|
|
3
|
-
slots: {
|
|
4
|
-
default?(_: {}): any;
|
|
5
|
-
};
|
|
6
|
-
refs: {};
|
|
7
|
-
rootEl: any;
|
|
8
|
-
};
|
|
9
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
10
|
-
declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
11
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
12
|
-
export default _default;
|
|
13
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
14
|
-
new (): {
|
|
15
|
-
$slots: S;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
interface DialogParam {
|
|
2
|
-
modelValue: boolean;
|
|
3
|
-
attrs?: Object;
|
|
4
|
-
title?: string;
|
|
5
|
-
width?: number | string;
|
|
6
|
-
draggable?: boolean;
|
|
7
|
-
showConfirmButton?: boolean;
|
|
8
|
-
showCancelButton?: boolean;
|
|
9
|
-
confirmButtonText?: string;
|
|
10
|
-
cancelButtonText?: string;
|
|
11
|
-
}
|
|
12
|
-
declare function __VLS_template(): {
|
|
13
|
-
attrs: Partial<{}>;
|
|
14
|
-
slots: {
|
|
15
|
-
header?(_: {
|
|
16
|
-
close: () => void;
|
|
17
|
-
titleId: string;
|
|
18
|
-
titleClass: string;
|
|
19
|
-
}): any;
|
|
20
|
-
default?(_: {}): any;
|
|
21
|
-
footer?(_: {}): any;
|
|
22
|
-
};
|
|
23
|
-
refs: {};
|
|
24
|
-
rootEl: any;
|
|
25
|
-
};
|
|
26
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
27
|
-
declare const __VLS_component: import('vue').DefineComponent<DialogParam, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
28
|
-
"update:modelValue": (...args: any[]) => void;
|
|
29
|
-
close: (...args: any[]) => void;
|
|
30
|
-
confirm: (...args: any[]) => void;
|
|
31
|
-
}, string, import('vue').PublicProps, Readonly<DialogParam> & Readonly<{
|
|
32
|
-
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
33
|
-
onClose?: (...args: any[]) => any;
|
|
34
|
-
onConfirm?: (...args: any[]) => any;
|
|
35
|
-
}>, {
|
|
36
|
-
modelValue: boolean;
|
|
37
|
-
title: string;
|
|
38
|
-
width: number | string;
|
|
39
|
-
draggable: boolean;
|
|
40
|
-
showConfirmButton: boolean;
|
|
41
|
-
showCancelButton: boolean;
|
|
42
|
-
confirmButtonText: string;
|
|
43
|
-
cancelButtonText: string;
|
|
44
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
45
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
46
|
-
export default _default;
|
|
47
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
48
|
-
new (): {
|
|
49
|
-
$slots: S;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
declare function __VLS_template(): {
|
|
2
|
-
attrs: Partial<{}>;
|
|
3
|
-
slots: {
|
|
4
|
-
image?(_: {}): any;
|
|
5
|
-
description?(_: {}): any;
|
|
6
|
-
default?(_: {}): any;
|
|
7
|
-
};
|
|
8
|
-
refs: {};
|
|
9
|
-
rootEl: any;
|
|
10
|
-
};
|
|
11
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
|
-
declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
13
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
14
|
-
export default _default;
|
|
15
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
16
|
-
new (): {
|
|
17
|
-
$slots: S;
|
|
18
|
-
};
|
|
19
|
-
};
|