@mc-markets/ui 1.0.35 → 1.0.37
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/{packages/index.d.ts → index.d.ts} +2 -1
- package/dist/index.js +4 -3
- package/dist/node_modules/@babel/parser/typings/babel-parser.d.ts +235 -0
- package/dist/node_modules/@babel/types/lib/index.d.ts +3308 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/conversion.d.ts +61 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/css-color-names.d.ts +4 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/format-input.d.ts +37 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/from-ratio.d.ts +14 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/index.d.ts +207 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/interfaces.d.ts +46 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/public_api.d.ts +11 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/random.d.ts +24 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/readability.d.ts +46 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/to-ms-filter.d.ts +5 -0
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.d.mts +514 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.mts +327 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts +103 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.mts +47 -0
- package/dist/node_modules/@types/lodash/common/array.d.ts +2137 -0
- package/dist/node_modules/@types/lodash/common/collection.d.ts +1938 -0
- package/dist/node_modules/@types/lodash/common/common.d.ts +287 -0
- package/dist/node_modules/@types/lodash/common/date.d.ts +23 -0
- package/dist/node_modules/@types/lodash/common/function.d.ts +1455 -0
- package/dist/node_modules/@types/lodash/common/lang.d.ts +1700 -0
- package/dist/node_modules/@types/lodash/common/math.d.ts +405 -0
- package/dist/node_modules/@types/lodash/common/number.d.ts +131 -0
- package/dist/node_modules/@types/lodash/common/object.d.ts +2643 -0
- package/dist/node_modules/@types/lodash/common/seq.d.ts +210 -0
- package/dist/node_modules/@types/lodash/common/string.d.ts +788 -0
- package/dist/node_modules/@types/lodash/common/util.d.ts +1220 -0
- package/dist/node_modules/@types/lodash/index.d.ts +21 -0
- package/dist/node_modules/@vue/compiler-core/dist/compiler-core.d.ts +1093 -0
- package/dist/node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts +45 -0
- package/dist/node_modules/@vue/reactivity/dist/reactivity.d.ts +756 -0
- package/dist/node_modules/@vue/runtime-core/dist/runtime-core.d.ts +1839 -0
- package/dist/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +1397 -0
- package/dist/node_modules/@vue/shared/dist/shared.d.ts +335 -0
- package/dist/node_modules/@vueuse/core/index.d.ts +4536 -0
- package/dist/node_modules/@vueuse/core/node_modules/vue-demi/lib/index.d.ts +22 -0
- package/dist/node_modules/@vueuse/shared/index.d.ts +1072 -0
- package/dist/node_modules/@vueuse/shared/node_modules/vue-demi/lib/index.d.ts +22 -0
- package/dist/node_modules/async-validator/dist-types/index.d.ts +43 -0
- package/dist/node_modules/async-validator/dist-types/interface.d.ts +135 -0
- package/dist/node_modules/csstype/index.d.ts +21297 -0
- package/dist/node_modules/dayjs/index.d.ts +429 -0
- package/dist/node_modules/dayjs/locale/index.d.ts +11 -0
- package/dist/node_modules/dayjs/locale/types.d.ts +33 -0
- package/dist/node_modules/element-plus/es/index.d.ts +26960 -0
- package/dist/node_modules/element-plus/es/utils/vue3.3.polyfill.d.ts +34 -0
- package/dist/node_modules/memoize-one/dist/memoize-one.d.ts +7 -0
- package/dist/node_modules/vue/dist/vue.d.mts +7 -0
- package/dist/style.css +1 -1
- package/dist/{packages/styles → styles}/theme-config.d.ts +0 -2
- package/dist/types/auto-imports.d.ts +84 -0
- package/dist/types/components.d.ts +55 -0
- package/package.json +5 -2
- package/packages/styles/element/form.scss +27 -0
- package/packages/styles/index.scss +5 -4
- package/packages/styles/theme-config.ts +0 -24
- package/packages/styles/variables.scss +131 -73
- package/USAGE.md +0 -383
- package/dist/src/main.d.ts +0 -0
- package/dist/src/utils/theme.d.ts +0 -66
- package/dist/vite.config.d.ts +0 -2
- /package/dist/{packages/components → components}/Alert/Alert.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/Alert/index.d.ts +0 -0
- /package/dist/{packages/components → components}/Banner/Banner.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/Banner/index.d.ts +0 -0
- /package/dist/{packages/components → components}/DatePicker/DatePicker.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/DatePicker/index.d.ts +0 -0
- /package/dist/{packages/components → components}/Dialog/index.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/Empty/Empty.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/Empty/index.d.ts +0 -0
- /package/dist/{packages/components → components}/Icon/index.d.ts +0 -0
- /package/dist/{packages/components → components}/Icon/types.d.ts +0 -0
- /package/dist/{packages/components → components}/Notification/Notification.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/Notification/index.d.ts +0 -0
- /package/dist/{packages/components → components}/Pagination/Pagination.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/Pagination/index.d.ts +0 -0
- /package/dist/{packages/components → components}/Tab/Tab.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/Tab/TabPane.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/Tooltips/Tooltips.vue.d.ts +0 -0
- /package/dist/{packages/components → components}/Tooltips/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,614 +0,0 @@
|
|
|
1
|
-
# @mc-markets/ui
|
|
2
|
-
|
|
3
|
-
一个功能强大的 Element Plus 完整导出包,提供所有组件、指令、服务、样式、主题和国际化支持。现已修复 Element Plus 组件自动导入问题,确保所有组件正常渲染。
|
|
4
|
-
|
|
5
|
-
## ✨ 特性
|
|
6
|
-
|
|
7
|
-
- 🚀 **Vue 3 + TypeScript** - 完全支持 Vue 3 Composition API 和 TypeScript
|
|
8
|
-
- 🎨 **Element Plus 完整导出** - 导出所有 Element Plus 组件、指令、服务
|
|
9
|
-
- 🌍 **多语言支持** - 内置 50+ 种语言包,支持国际化
|
|
10
|
-
- 🎨 **主题定制** - 支持动态主题切换和暗色模式
|
|
11
|
-
- 🔧 **开箱即用** - 提供完整的类型定义和示例代码
|
|
12
|
-
- 📦 **轻量级** - 基于 Element Plus 构建,保持一致的视觉风格
|
|
13
|
-
- 🛠️ **开发友好** - 完整的 TypeScript 支持和自动导入配置
|
|
14
|
-
|
|
15
|
-
## 📦 安装
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install @mc-markets/ui
|
|
19
|
-
# 或
|
|
20
|
-
yarn add @mc-markets/ui
|
|
21
|
-
# 或
|
|
22
|
-
pnpm add @mc-markets/ui
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### 依赖要求
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# 安装 Element Plus(必需)
|
|
29
|
-
npm install element-plus
|
|
30
|
-
# 或
|
|
31
|
-
yarn add element-plus
|
|
32
|
-
# 或
|
|
33
|
-
pnpm add element-plus
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## 🔧 使用
|
|
37
|
-
|
|
38
|
-
### 完整引入
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
import { createApp } from 'vue'
|
|
42
|
-
import ElementPlus from 'element-plus'
|
|
43
|
-
import 'element-plus/dist/index.css'
|
|
44
|
-
import McMarketsUI from '@mc-markets/ui'
|
|
45
|
-
import '@mc-markets/ui/dist/style.css'
|
|
46
|
-
|
|
47
|
-
const app = createApp(App)
|
|
48
|
-
app.use(ElementPlus)
|
|
49
|
-
app.use(McMarketsUI)
|
|
50
|
-
app.mount('#app')
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 按需引入
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
import { createApp } from 'vue'
|
|
57
|
-
import ElementPlus from 'element-plus'
|
|
58
|
-
import 'element-plus/dist/index.css'
|
|
59
|
-
import { ElButton, ElInput, ElTable } from '@mc-markets/ui'
|
|
60
|
-
import '@mc-markets/ui/dist/style.css'
|
|
61
|
-
|
|
62
|
-
const app = createApp(App)
|
|
63
|
-
app.use(ElementPlus)
|
|
64
|
-
app.component('ElButton', ElButton)
|
|
65
|
-
app.component('ElInput', ElInput)
|
|
66
|
-
app.component('ElTable', ElTable)
|
|
67
|
-
app.mount('#app')
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 自动导入配置(推荐)
|
|
71
|
-
|
|
72
|
-
如果使用 Vite,可以配置自动导入:
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
// vite.config.ts
|
|
76
|
-
import { defineConfig } from 'vite'
|
|
77
|
-
import vue from '@vitejs/plugin-vue'
|
|
78
|
-
import AutoImport from 'unplugin-auto-import/vite'
|
|
79
|
-
import Components from 'unplugin-vue-components/vite'
|
|
80
|
-
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
81
|
-
|
|
82
|
-
export default defineConfig({
|
|
83
|
-
plugins: [
|
|
84
|
-
vue(),
|
|
85
|
-
AutoImport({
|
|
86
|
-
resolvers: [ElementPlusResolver()],
|
|
87
|
-
}),
|
|
88
|
-
Components({
|
|
89
|
-
resolvers: [ElementPlusResolver({
|
|
90
|
-
importStyle: 'css'
|
|
91
|
-
})],
|
|
92
|
-
}),
|
|
93
|
-
],
|
|
94
|
-
})
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
然后在 `main.ts` 中:
|
|
98
|
-
|
|
99
|
-
```typescript
|
|
100
|
-
import { createApp } from 'vue'
|
|
101
|
-
import App from './App.vue'
|
|
102
|
-
import ElementPlus from 'element-plus'
|
|
103
|
-
import 'element-plus/dist/index.css'
|
|
104
|
-
|
|
105
|
-
const app = createApp(App)
|
|
106
|
-
app.use(ElementPlus)
|
|
107
|
-
app.mount('#app')
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## 🚀 快速开始
|
|
111
|
-
|
|
112
|
-
### 在线演示
|
|
113
|
-
|
|
114
|
-
访问 [在线演示](http://localhost:5175/) 查看所有组件的实际效果。
|
|
115
|
-
|
|
116
|
-
### 本地演示
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
# 克隆项目
|
|
120
|
-
git clone https://gitee.com/daboluoxigua/npm-mc-markets-ui.git
|
|
121
|
-
|
|
122
|
-
# 进入项目目录
|
|
123
|
-
cd npm-mc-markets-ui
|
|
124
|
-
|
|
125
|
-
# 安装依赖
|
|
126
|
-
npm install
|
|
127
|
-
|
|
128
|
-
# 启动演示服务器
|
|
129
|
-
npm run dev
|
|
130
|
-
|
|
131
|
-
# 访问 http://localhost:5173
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## 🔧 问题修复
|
|
135
|
-
|
|
136
|
-
### Element Plus 组件导入问题
|
|
137
|
-
|
|
138
|
-
**问题描述:** 在之前的版本中,Element Plus 组件(如 `el-form`、`el-table` 等)无法正确自动导入,导致组件无法渲染。
|
|
139
|
-
|
|
140
|
-
**解决方案:**
|
|
141
|
-
1. 在 `main.ts` 中显式导入 Element Plus
|
|
142
|
-
2. 配置 Vite 自动导入插件
|
|
143
|
-
3. 确保样式文件正确加载
|
|
144
|
-
|
|
145
|
-
**修复后的配置:**
|
|
146
|
-
|
|
147
|
-
```typescript
|
|
148
|
-
// main.ts
|
|
149
|
-
import { createApp } from 'vue'
|
|
150
|
-
import App from './App.vue'
|
|
151
|
-
import ElementPlus from 'element-plus'
|
|
152
|
-
import 'element-plus/dist/index.css'
|
|
153
|
-
|
|
154
|
-
const app = createApp(App)
|
|
155
|
-
app.use(ElementPlus)
|
|
156
|
-
app.mount('#app')
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
// vite.config.ts
|
|
161
|
-
import AutoImport from 'unplugin-auto-import/vite'
|
|
162
|
-
import Components from 'unplugin-vue-components/vite'
|
|
163
|
-
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
164
|
-
|
|
165
|
-
export default defineConfig({
|
|
166
|
-
plugins: [
|
|
167
|
-
AutoImport({
|
|
168
|
-
resolvers: [ElementPlusResolver()],
|
|
169
|
-
}),
|
|
170
|
-
Components({
|
|
171
|
-
resolvers: [ElementPlusResolver({
|
|
172
|
-
importStyle: 'css'
|
|
173
|
-
})],
|
|
174
|
-
}),
|
|
175
|
-
],
|
|
176
|
-
})
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
## 🌍 国际化支持
|
|
180
|
-
|
|
181
|
-
### 支持的语言
|
|
182
|
-
|
|
183
|
-
支持 50+ 种语言,包括:
|
|
184
|
-
|
|
185
|
-
- **中文** - zh-cn, zh-tw
|
|
186
|
-
- **英语** - en
|
|
187
|
-
- **日语** - ja
|
|
188
|
-
- **韩语** - ko
|
|
189
|
-
- **西班牙语** - es
|
|
190
|
-
- **法语** - fr
|
|
191
|
-
- **德语** - de
|
|
192
|
-
- **意大利语** - it
|
|
193
|
-
- **葡萄牙语** - pt
|
|
194
|
-
- **俄语** - ru
|
|
195
|
-
- **土耳其语** - tr
|
|
196
|
-
- **乌克兰语** - uk
|
|
197
|
-
- **越南语** - vi
|
|
198
|
-
- **泰语** - th
|
|
199
|
-
- **印尼语** - id
|
|
200
|
-
- **马来语** - ms
|
|
201
|
-
- **荷兰语** - nl
|
|
202
|
-
- **瑞典语** - sv
|
|
203
|
-
- **挪威语** - no
|
|
204
|
-
- **丹麦语** - da
|
|
205
|
-
- **芬兰语** - fi
|
|
206
|
-
- **波兰语** - pl
|
|
207
|
-
- **捷克语** - cs
|
|
208
|
-
- **匈牙利语** - hu
|
|
209
|
-
- **罗马尼亚语** - ro
|
|
210
|
-
- **斯洛伐克语** - sk
|
|
211
|
-
- **斯洛文尼亚语** - sl
|
|
212
|
-
- **克罗地亚语** - hr
|
|
213
|
-
- **保加利亚语** - bg
|
|
214
|
-
- **爱沙尼亚语** - et
|
|
215
|
-
- **拉脱维亚语** - lv
|
|
216
|
-
- **立陶宛语** - lt
|
|
217
|
-
- **希腊语** - el
|
|
218
|
-
- **希伯来语** - he
|
|
219
|
-
- **阿拉伯语** - ar
|
|
220
|
-
- **波斯语** - fa
|
|
221
|
-
- **印地语** - hi
|
|
222
|
-
- **孟加拉语** - bn
|
|
223
|
-
- **泰米尔语** - ta
|
|
224
|
-
- **泰卢固语** - te
|
|
225
|
-
- **旁遮普语** - pa
|
|
226
|
-
- **高棉语** - km
|
|
227
|
-
- **老挝语** - lo
|
|
228
|
-
- **缅甸语** - my
|
|
229
|
-
- **阿塞拜疆语** - az
|
|
230
|
-
- **哈萨克语** - kk
|
|
231
|
-
- **吉尔吉斯语** - ky
|
|
232
|
-
- **土库曼语** - tk
|
|
233
|
-
- **蒙古语** - mn
|
|
234
|
-
|
|
235
|
-
### 使用示例
|
|
236
|
-
|
|
237
|
-
```typescript
|
|
238
|
-
import { createApp } from 'vue'
|
|
239
|
-
import ElementPlus from 'element-plus'
|
|
240
|
-
import McMarketsUI, {
|
|
241
|
-
ElementPlusLocaleZhCn,
|
|
242
|
-
ElementPlusLocaleEn,
|
|
243
|
-
getLocale,
|
|
244
|
-
switchLocale
|
|
245
|
-
} from '@mc-markets/ui'
|
|
246
|
-
|
|
247
|
-
const app = createApp(App)
|
|
248
|
-
|
|
249
|
-
// 使用中文语言包
|
|
250
|
-
app.use(ElementPlus, {
|
|
251
|
-
locale: ElementPlusLocaleZhCn
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
// 或者使用工具函数
|
|
255
|
-
const locale = getLocale('zh-cn')
|
|
256
|
-
app.use(ElementPlus, { locale })
|
|
257
|
-
|
|
258
|
-
app.use(McMarketsUI)
|
|
259
|
-
app.mount('#app')
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
## 🎨 主题定制
|
|
263
|
-
|
|
264
|
-
### 主题配置
|
|
265
|
-
|
|
266
|
-
```typescript
|
|
267
|
-
import { createApp } from 'vue'
|
|
268
|
-
import ElementPlus from 'element-plus'
|
|
269
|
-
import McMarketsUI, { themeManager } from '@mc-markets/ui'
|
|
270
|
-
|
|
271
|
-
const app = createApp(App)
|
|
272
|
-
|
|
273
|
-
// 设置主题
|
|
274
|
-
themeManager.setTheme({
|
|
275
|
-
name: 'custom',
|
|
276
|
-
dark: false,
|
|
277
|
-
cssVars: {
|
|
278
|
-
'--el-color-primary': '#409eff',
|
|
279
|
-
'--el-color-success': '#67c23a',
|
|
280
|
-
'--el-color-warning': '#e6a23c',
|
|
281
|
-
'--el-color-danger': '#f56c6c',
|
|
282
|
-
'--el-color-info': '#909399'
|
|
283
|
-
}
|
|
284
|
-
})
|
|
285
|
-
|
|
286
|
-
app.use(ElementPlus)
|
|
287
|
-
app.use(McMarketsUI)
|
|
288
|
-
app.mount('#app')
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### 暗色模式
|
|
292
|
-
|
|
293
|
-
```typescript
|
|
294
|
-
import { themeManager } from '@mc-markets/ui'
|
|
295
|
-
|
|
296
|
-
// 切换暗色模式
|
|
297
|
-
themeManager.toggleDark()
|
|
298
|
-
|
|
299
|
-
// 设置暗色模式
|
|
300
|
-
themeManager.setTheme({
|
|
301
|
-
name: 'dark',
|
|
302
|
-
dark: true
|
|
303
|
-
})
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
## 🎯 组件使用
|
|
307
|
-
|
|
308
|
-
### 基础组件
|
|
309
|
-
|
|
310
|
-
```vue
|
|
311
|
-
<template>
|
|
312
|
-
<div class="demo">
|
|
313
|
-
<!-- 按钮组件 -->
|
|
314
|
-
<el-button type="primary">主要按钮</el-button>
|
|
315
|
-
<el-button type="success">成功按钮</el-button>
|
|
316
|
-
<el-button type="warning">警告按钮</el-button>
|
|
317
|
-
<el-button type="danger">危险按钮</el-button>
|
|
318
|
-
<el-button type="info">信息按钮</el-button>
|
|
319
|
-
|
|
320
|
-
<!-- 输入组件 -->
|
|
321
|
-
<el-input v-model="inputValue" placeholder="请输入内容" />
|
|
322
|
-
|
|
323
|
-
<!-- 选择器 -->
|
|
324
|
-
<el-select v-model="selectValue" placeholder="请选择">
|
|
325
|
-
<el-option label="选项1" value="1" />
|
|
326
|
-
<el-option label="选项2" value="2" />
|
|
327
|
-
</el-select>
|
|
328
|
-
</div>
|
|
329
|
-
</template>
|
|
330
|
-
|
|
331
|
-
<script setup lang="ts">
|
|
332
|
-
import { ref } from 'vue'
|
|
333
|
-
|
|
334
|
-
const inputValue = ref('')
|
|
335
|
-
const selectValue = ref('')
|
|
336
|
-
</script>
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### 表格组件
|
|
340
|
-
|
|
341
|
-
```vue
|
|
342
|
-
<template>
|
|
343
|
-
<el-table :data="tableData" style="width: 100%">
|
|
344
|
-
<el-table-column prop="name" label="姓名" width="120" />
|
|
345
|
-
<el-table-column prop="age" label="年龄" width="80" />
|
|
346
|
-
<el-table-column prop="email" label="邮箱" />
|
|
347
|
-
<el-table-column prop="status" label="状态" width="100">
|
|
348
|
-
<template #default="scope">
|
|
349
|
-
<el-tag :type="scope.row.status === 'active' ? 'success' : 'danger'">
|
|
350
|
-
{{ scope.row.status === 'active' ? '活跃' : '禁用' }}
|
|
351
|
-
</el-tag>
|
|
352
|
-
</template>
|
|
353
|
-
</el-table-column>
|
|
354
|
-
<el-table-column label="操作" width="150">
|
|
355
|
-
<template #default="scope">
|
|
356
|
-
<el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
|
357
|
-
<el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
|
358
|
-
</template>
|
|
359
|
-
</el-table-column>
|
|
360
|
-
</el-table>
|
|
361
|
-
|
|
362
|
-
<el-pagination
|
|
363
|
-
v-model:current-page="currentPage"
|
|
364
|
-
v-model:page-size="pageSize"
|
|
365
|
-
:page-sizes="[10, 20, 50, 100]"
|
|
366
|
-
:total="total"
|
|
367
|
-
layout="total, sizes, prev, pager, next, jumper"
|
|
368
|
-
style="margin-top: 20px; text-align: right;"
|
|
369
|
-
/>
|
|
370
|
-
</template>
|
|
371
|
-
|
|
372
|
-
<script setup lang="ts">
|
|
373
|
-
import { ref } from 'vue'
|
|
374
|
-
|
|
375
|
-
const currentPage = ref(1)
|
|
376
|
-
const pageSize = ref(10)
|
|
377
|
-
const total = ref(100)
|
|
378
|
-
|
|
379
|
-
const tableData = ref([
|
|
380
|
-
{ name: '张三', age: 25, email: 'zhangsan@example.com', status: 'active' },
|
|
381
|
-
{ name: '李四', age: 30, email: 'lisi@example.com', status: 'inactive' },
|
|
382
|
-
{ name: '王五', age: 28, email: 'wangwu@example.com', status: 'active' }
|
|
383
|
-
])
|
|
384
|
-
|
|
385
|
-
const handleEdit = (row: any) => {
|
|
386
|
-
console.log('编辑', row)
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
const handleDelete = (row: any) => {
|
|
390
|
-
console.log('删除', row)
|
|
391
|
-
}
|
|
392
|
-
</script>
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### 表单组件
|
|
396
|
-
|
|
397
|
-
```vue
|
|
398
|
-
<template>
|
|
399
|
-
<el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
|
|
400
|
-
<el-form-item label="用户名" prop="username">
|
|
401
|
-
<el-input v-model="form.username" placeholder="请输入用户名" />
|
|
402
|
-
</el-form-item>
|
|
403
|
-
<el-form-item label="邮箱" prop="email">
|
|
404
|
-
<el-input v-model="form.email" placeholder="请输入邮箱" />
|
|
405
|
-
</el-form-item>
|
|
406
|
-
<el-form-item label="性别" prop="gender">
|
|
407
|
-
<el-select v-model="form.gender" placeholder="请选择性别">
|
|
408
|
-
<el-option label="男" value="male" />
|
|
409
|
-
<el-option label="女" value="female" />
|
|
410
|
-
</el-select>
|
|
411
|
-
</el-form-item>
|
|
412
|
-
<el-form-item label="生日" prop="birthday">
|
|
413
|
-
<el-date-picker
|
|
414
|
-
v-model="form.birthday"
|
|
415
|
-
type="date"
|
|
416
|
-
placeholder="选择日期"
|
|
417
|
-
style="width: 100%;"
|
|
418
|
-
/>
|
|
419
|
-
</el-form-item>
|
|
420
|
-
<el-form-item>
|
|
421
|
-
<el-button type="primary" @click="submitForm">提交</el-button>
|
|
422
|
-
<el-button @click="resetForm">重置</el-button>
|
|
423
|
-
</el-form-item>
|
|
424
|
-
</el-form>
|
|
425
|
-
</template>
|
|
426
|
-
|
|
427
|
-
<script setup lang="ts">
|
|
428
|
-
import { ref, reactive } from 'vue'
|
|
429
|
-
|
|
430
|
-
const formRef = ref()
|
|
431
|
-
|
|
432
|
-
const form = reactive({
|
|
433
|
-
username: '',
|
|
434
|
-
email: '',
|
|
435
|
-
gender: '',
|
|
436
|
-
birthday: ''
|
|
437
|
-
})
|
|
438
|
-
|
|
439
|
-
const rules = {
|
|
440
|
-
username: [
|
|
441
|
-
{ required: true, message: '请输入用户名', trigger: 'blur' }
|
|
442
|
-
],
|
|
443
|
-
email: [
|
|
444
|
-
{ required: true, message: '请输入邮箱', trigger: 'blur' },
|
|
445
|
-
{ type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' }
|
|
446
|
-
],
|
|
447
|
-
gender: [
|
|
448
|
-
{ required: true, message: '请选择性别', trigger: 'change' }
|
|
449
|
-
]
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
const submitForm = async () => {
|
|
453
|
-
try {
|
|
454
|
-
await formRef.value.validate()
|
|
455
|
-
console.log('表单提交成功!', form)
|
|
456
|
-
} catch (error) {
|
|
457
|
-
console.log('表单验证失败!')
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
const resetForm = () => {
|
|
462
|
-
formRef.value.resetFields()
|
|
463
|
-
}
|
|
464
|
-
</script>
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
## 🔧 API 配置
|
|
468
|
-
|
|
469
|
-
### 主题管理
|
|
470
|
-
|
|
471
|
-
| 方法 | 说明 | 参数 | 返回值 |
|
|
472
|
-
|------|------|------|--------|
|
|
473
|
-
| setTheme | 设置主题 | theme: ThemeConfig | void |
|
|
474
|
-
| getTheme | 获取当前主题 | - | ThemeConfig |
|
|
475
|
-
| toggleDark | 切换暗色模式 | - | void |
|
|
476
|
-
|
|
477
|
-
### 国际化
|
|
478
|
-
|
|
479
|
-
| 方法 | 说明 | 参数 | 返回值 |
|
|
480
|
-
|------|------|------|--------|
|
|
481
|
-
| getLocale | 获取语言包 | locale: string | Locale |
|
|
482
|
-
| switchLocale | 切换语言 | locale: string | Locale |
|
|
483
|
-
| getSupportedLocales | 获取支持的语言列表 | - | string[] |
|
|
484
|
-
|
|
485
|
-
### 主题配置接口
|
|
486
|
-
|
|
487
|
-
```typescript
|
|
488
|
-
interface ThemeConfig {
|
|
489
|
-
/** 主题名称 */
|
|
490
|
-
name?: string
|
|
491
|
-
/** 是否暗色主题 */
|
|
492
|
-
dark?: boolean
|
|
493
|
-
/** 自定义CSS变量 */
|
|
494
|
-
cssVars?: Record<string, string>
|
|
495
|
-
/** 自定义类名 */
|
|
496
|
-
customClass?: string
|
|
497
|
-
}
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
## 🎨 样式定制
|
|
501
|
-
|
|
502
|
-
组件库使用 CSS 变量,可以通过覆盖变量来自定义样式:
|
|
503
|
-
|
|
504
|
-
```css
|
|
505
|
-
:root {
|
|
506
|
-
--el-color-primary: #409eff;
|
|
507
|
-
--el-color-success: #67c23a;
|
|
508
|
-
--el-color-warning: #e6a23c;
|
|
509
|
-
--el-color-danger: #f56c6c;
|
|
510
|
-
--el-color-info: #909399;
|
|
511
|
-
--el-border-radius-base: 4px;
|
|
512
|
-
--el-font-size-base: 14px;
|
|
513
|
-
--el-spacing-base: 20px;
|
|
514
|
-
}
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
## 📚 类型定义
|
|
518
|
-
|
|
519
|
-
完整的 TypeScript 类型定义:
|
|
520
|
-
|
|
521
|
-
```typescript
|
|
522
|
-
import type {
|
|
523
|
-
ThemeConfig,
|
|
524
|
-
ThemeManager,
|
|
525
|
-
McMarketsUI
|
|
526
|
-
} from '@mc-markets/ui'
|
|
527
|
-
|
|
528
|
-
// 导入所有 Element Plus 类型
|
|
529
|
-
import type {
|
|
530
|
-
ButtonProps,
|
|
531
|
-
InputProps,
|
|
532
|
-
TableProps,
|
|
533
|
-
FormProps
|
|
534
|
-
} from '@mc-markets/ui'
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
## 🤝 贡献
|
|
538
|
-
|
|
539
|
-
欢迎提交 Issue 和 Pull Request!
|
|
540
|
-
|
|
541
|
-
## 📄 许可证
|
|
542
|
-
|
|
543
|
-
[MIT License](LICENSE)
|
|
544
|
-
|
|
545
|
-
## 🔗 相关链接
|
|
546
|
-
|
|
547
|
-
- [Vue 3](https://vuejs.org/)
|
|
548
|
-
- [Element Plus](https://element-plus.org/)
|
|
549
|
-
- [TypeScript](https://www.typescriptlang.org/)
|
|
550
|
-
|
|
551
|
-
## 🛠️ 开发指南
|
|
552
|
-
|
|
553
|
-
### 本地开发
|
|
554
|
-
|
|
555
|
-
```bash
|
|
556
|
-
# 安装依赖
|
|
557
|
-
npm install
|
|
558
|
-
|
|
559
|
-
# 启动开发服务器
|
|
560
|
-
npm run dev
|
|
561
|
-
|
|
562
|
-
# 类型检查
|
|
563
|
-
npm run type-check
|
|
564
|
-
|
|
565
|
-
# 代码格式化
|
|
566
|
-
npm run format
|
|
567
|
-
|
|
568
|
-
# 代码检查
|
|
569
|
-
npm run lint
|
|
570
|
-
```
|
|
571
|
-
|
|
572
|
-
### 构建和发布
|
|
573
|
-
|
|
574
|
-
```bash
|
|
575
|
-
# 构建项目
|
|
576
|
-
npm run build
|
|
577
|
-
|
|
578
|
-
# 发布到 npm(自动构建 + 发布)
|
|
579
|
-
npm run publish:lib
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
**注意:** 发布时会自动执行构建,无需手动构建。
|
|
583
|
-
|
|
584
|
-
### 项目结构
|
|
585
|
-
|
|
586
|
-
```
|
|
587
|
-
@mc-markets/ui/
|
|
588
|
-
├── packages/ # 组件库源码
|
|
589
|
-
│ ├── styles/ # 样式文件
|
|
590
|
-
│ ├── types/ # 类型定义
|
|
591
|
-
│ └── index.ts # 入口文件
|
|
592
|
-
├── src/ # 演示应用源码
|
|
593
|
-
│ ├── components/ # 演示组件
|
|
594
|
-
│ ├── styles/ # 演示样式
|
|
595
|
-
│ ├── utils/ # 工具函数
|
|
596
|
-
│ ├── App.vue # 主应用组件
|
|
597
|
-
│ └── main.ts # 应用入口
|
|
598
|
-
├── dist/ # 构建输出
|
|
599
|
-
├── vite.config.ts # Vite 配置
|
|
600
|
-
├── package.json # 项目配置
|
|
601
|
-
└── README.md # 项目文档
|
|
602
|
-
```
|
|
603
|
-
|
|
604
|
-
### 演示功能
|
|
605
|
-
|
|
606
|
-
当前演示应用包含以下功能:
|
|
607
|
-
|
|
608
|
-
- **组件展示** - 按钮、输入框、开关、评分、进度条等基础组件
|
|
609
|
-
- **表单组件** - 完整的表单示例,包含验证规则
|
|
610
|
-
- **表格组件** - 数据表格展示,支持分页和操作
|
|
611
|
-
- **主题配置** - 动态主题切换和颜色配置
|
|
612
|
-
- **国际化** - 多语言支持演示
|
|
613
|
-
|
|
614
|
-
访问 http://localhost:5175/ 查看完整演示。
|
|
@@ -12,7 +12,8 @@ import { Empty } from './components/Empty';
|
|
|
12
12
|
import { Tooltips } from './components/Tooltips';
|
|
13
13
|
export { TDDialog, Icon, Tab, TabPane, Alert, Notification, DatePicker, Pagination, Banner, Empty, Tooltips };
|
|
14
14
|
export * from './styles/theme-config';
|
|
15
|
-
export { default as
|
|
15
|
+
export { default as variables } from './styles/variables.scss?inline';
|
|
16
|
+
export { default as styles } from './styles/index.scss?inline';
|
|
16
17
|
interface McMarketsUI {
|
|
17
18
|
version: string;
|
|
18
19
|
author: string;
|