fantasia-ui 0.1.32 → 0.2.3

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.
Files changed (92) hide show
  1. package/README.en.md +255 -84
  2. package/README.md +254 -83
  3. package/dist/fantasia-ui.css +1 -0
  4. package/dist/fantasia-ui.es.js +1221 -34406
  5. package/dist/fantasia-ui.umd.js +1 -62
  6. package/dist/types/assets/index.d.ts +5 -0
  7. package/dist/types/assets/index.js +5 -0
  8. package/dist/types/components/index.d.ts +27 -0
  9. package/dist/types/components/index.js +27 -0
  10. package/dist/types/index.d.ts +4 -2
  11. package/dist/types/index.js +15 -0
  12. package/dist/types/types/components/index.d.ts +32 -0
  13. package/dist/types/types/components/index.js +32 -0
  14. package/dist/types/types/components/modules/base.d.ts +7 -0
  15. package/dist/types/types/components/modules/base.js +1 -0
  16. package/dist/types/types/components/modules/f-affix.d.ts +5 -0
  17. package/dist/types/types/components/modules/f-affix.js +1 -0
  18. package/dist/types/types/components/modules/f-avatar.d.ts +10 -0
  19. package/dist/types/types/components/modules/f-avatar.js +1 -0
  20. package/dist/types/types/components/modules/f-badge.d.ts +9 -0
  21. package/dist/types/types/components/modules/f-badge.js +1 -0
  22. package/dist/types/types/components/modules/f-breadcrumb.d.ts +10 -0
  23. package/dist/types/types/components/modules/f-breadcrumb.js +1 -0
  24. package/dist/types/types/components/modules/f-button.d.ts +9 -0
  25. package/dist/types/types/components/modules/f-button.js +1 -0
  26. package/dist/types/types/components/modules/f-card.d.ts +6 -0
  27. package/dist/types/types/components/modules/f-card.js +1 -0
  28. package/dist/types/types/components/modules/f-col.d.ts +15 -0
  29. package/dist/types/types/components/modules/f-col.js +1 -0
  30. package/dist/types/types/components/modules/f-container.d.ts +4 -0
  31. package/dist/types/types/components/modules/f-container.js +1 -0
  32. package/dist/types/types/components/modules/f-dialog.d.ts +6 -0
  33. package/dist/types/types/components/modules/f-dialog.js +1 -0
  34. package/dist/types/types/components/modules/f-divider.d.ts +8 -0
  35. package/dist/types/types/components/modules/f-divider.js +1 -0
  36. package/dist/types/types/components/modules/f-dropdown.d.ts +17 -0
  37. package/dist/types/types/components/modules/f-dropdown.js +1 -0
  38. package/dist/types/types/components/modules/f-form.d.ts +83 -0
  39. package/dist/types/types/components/modules/f-form.js +1 -0
  40. package/dist/types/types/components/modules/f-icon.d.ts +5 -0
  41. package/dist/types/types/components/modules/f-icon.js +1 -0
  42. package/dist/types/types/components/modules/f-image.d.ts +8 -0
  43. package/dist/types/types/components/modules/f-image.js +1 -0
  44. package/dist/types/types/components/modules/f-input.d.ts +9 -0
  45. package/dist/types/types/components/modules/f-input.js +1 -0
  46. package/dist/types/types/components/modules/f-link.d.ts +8 -0
  47. package/dist/types/types/components/modules/f-link.js +1 -0
  48. package/dist/types/types/components/modules/f-loading.d.ts +6 -0
  49. package/dist/types/types/components/modules/f-loading.js +1 -0
  50. package/dist/types/types/components/modules/f-menu.d.ts +13 -0
  51. package/dist/types/types/components/modules/f-menu.js +1 -0
  52. package/dist/types/types/components/modules/f-pagination.d.ts +6 -0
  53. package/dist/types/types/components/modules/f-pagination.js +1 -0
  54. package/dist/types/types/components/modules/f-progress.d.ts +7 -0
  55. package/dist/types/types/components/modules/f-progress.js +1 -0
  56. package/dist/types/types/components/modules/f-rate.d.ts +12 -0
  57. package/dist/types/types/components/modules/f-rate.js +1 -0
  58. package/dist/types/types/components/modules/f-row.d.ts +9 -0
  59. package/dist/types/types/components/modules/f-row.js +1 -0
  60. package/dist/types/types/components/modules/f-slider-captcha.d.ts +16 -0
  61. package/dist/types/types/components/modules/f-slider-captcha.js +2 -0
  62. package/dist/types/types/components/modules/f-space.d.ts +11 -0
  63. package/dist/types/types/components/modules/f-space.js +1 -0
  64. package/dist/types/types/components/modules/f-table.d.ts +12 -0
  65. package/dist/types/types/components/modules/f-table.js +1 -0
  66. package/dist/types/types/components/modules/f-tabs.d.ts +12 -0
  67. package/dist/types/types/components/modules/f-tabs.js +1 -0
  68. package/dist/types/types/components/modules/f-tag.d.ts +10 -0
  69. package/dist/types/types/components/modules/f-tag.js +1 -0
  70. package/dist/types/types/components/modules/f-tagsview.d.ts +7 -0
  71. package/dist/types/types/components/modules/f-tagsview.js +1 -0
  72. package/dist/types/types/components/modules/f-text.d.ts +10 -0
  73. package/dist/types/types/components/modules/f-text.js +1 -0
  74. package/dist/types/types/components/modules/f-toolbar.d.ts +26 -0
  75. package/dist/types/types/components/modules/f-toolbar.js +1 -0
  76. package/dist/types/types/components/modules/f-tooltip.d.ts +10 -0
  77. package/dist/types/types/components/modules/f-tooltip.js +1 -0
  78. package/dist/types/types/components/modules/f-upload.d.ts +11 -0
  79. package/dist/types/types/components/modules/f-upload.js +1 -0
  80. package/dist/types/types/index.d.ts +2 -0
  81. package/dist/types/types/index.js +2 -0
  82. package/dist/types/types/models/index.d.ts +26 -0
  83. package/dist/types/types/models/index.js +1 -0
  84. package/package.json +47 -22
  85. package/dist/components/index.d.ts +0 -3
  86. package/dist/components/modules/FTable.vue.d.ts +0 -153
  87. package/dist/components/modules/FUpload.vue.d.ts +0 -1428
  88. package/dist/favicon.ico +0 -0
  89. package/dist/index.css +0 -1
  90. package/dist/index.d.ts +0 -5
  91. package/dist/types/modules/f-table.d.ts +0 -64
  92. package/dist/types/modules/f-upload.d.ts +0 -15
package/README.en.md CHANGED
@@ -1,103 +1,274 @@
1
- # Fantasia UI Component Library
1
+ # Fantasia UI
2
2
 
3
- ### Upload Component
3
+ <p align="center">
4
+ <img src="https://img.shields.io/npm/v/fantasia-ui" alt="npm version">
5
+ <img src="https://img.shields.io/npm/dm/fantasia-ui" alt="npm downloads">
6
+ <img src="https://img.shields.io/npm/l/fantasia-ui" alt="license">
7
+ <img src="https://img.shields.io/badge/vue-3.x-brightgreen.svg" alt="vue3">
8
+ </p>
9
+
10
+ <p align="center">
11
+ A modern UI component library based on Vue 3 + TypeScript
12
+ </p>
13
+
14
+ <p align="center">
15
+ English | <a href="./README.md">简体中文</a>
16
+ </p>
17
+
18
+ ## ✨ Features
19
+
20
+ - 🎨 **Modern Design** - Clean and elegant design style
21
+ - 🔧 **TypeScript** - Full TypeScript support with type definitions
22
+ - 📦 **Tree Shaking** - Support on-demand loading to reduce bundle size
23
+ - ⚡ **Vue 3** - Built with Vue 3 Composition API
24
+ - 🎯 **Out of the Box** - Rich components for daily development needs
25
+ - 📱 **Responsive** - Mobile-friendly interaction experience
26
+
27
+ ## 📦 Installation
28
+
29
+ ```bash
30
+ # npm
31
+ npm install fantasia-ui
32
+
33
+ # yarn
34
+ yarn add fantasia-ui
35
+
36
+ # pnpm
37
+ pnpm add fantasia-ui
38
+ ```
39
+
40
+ ### Optional Dependencies
41
+
42
+ If you need to use icon components, install additionally:
43
+
44
+ ```bash
45
+ # Install icon library (optional)
46
+ npm install @vicons/ionicons5
47
+
48
+ # If using VueUse features (optional)
49
+ npm install @vueuse/core
50
+ ```
51
+
52
+ ## 🔨 Quick Start
53
+
54
+ ### Global Registration
55
+
56
+ ```typescript
57
+ // main.ts
58
+ import { createApp } from 'vue'
59
+ import FantasiaUI, { install } from 'fantasia-ui'
60
+ import 'fantasia-ui/dist/index.css'
61
+ import App from './App.vue'
62
+
63
+ const app = createApp(App)
64
+ app.use(install)
65
+ app.mount('#app')
66
+ ```
67
+
68
+ ### Import on Demand
69
+
70
+ ```vue
71
+ <script setup lang="ts">
72
+ import { FButton, FInput } from 'fantasia-ui'
73
+ import 'fantasia-ui/dist/index.css'
74
+ </script>
75
+
76
+ <template>
77
+ <FButton type="primary">Button</FButton>
78
+ <FInput v-model="value" placeholder="Please input" />
79
+ </template>
80
+ ```
81
+
82
+ ## 📚 Component List
83
+
84
+ ### Basic Components
85
+ - **FButton** - Button
86
+ - **FIcon** - Icon
87
+ - **FText** - Text
88
+ - **FLink** - Link
89
+ - **FTypography** - Typography
90
+
91
+ ### Layout Components
92
+ - **FContainer** - Container
93
+ - **FRow** - Row
94
+ - **FCol** - Column
95
+ - **FSpace** - Space
96
+ - **FDivider** - Divider
97
+
98
+ ### Data Display
99
+ - **FCard** - Card
100
+ - **FImage** - Image
101
+ - **FAvatar** - Avatar
102
+ - **FBadge** - Badge
103
+ - **FTag** - Tag
104
+ - **FProgress** - Progress
105
+ - **FRate** - Rate
106
+ - **FBreadcrumb** - Breadcrumb
107
+
108
+ ### Form Components
109
+ - **FInput** - Input
110
+ - **FSelect** - Select
111
+ - **FUpload** - Upload
112
+
113
+ ### Data Components
114
+ - **FPagination** - Pagination
115
+ - **FTabs** - Tabs
116
+
117
+ ### Feedback Components
118
+ - **FLoading** - Loading
119
+ - **FTooltip** - Tooltip
120
+ - **FSliderCaptcha** - Slider Captcha
121
+
122
+ ### Others
123
+ - **FDropdown** - Dropdown
124
+ - **FAffix** - Affix
125
+
126
+ ## 📝 Usage Examples
127
+
128
+ ### Button Component
129
+
130
+ ```vue
131
+ <script setup lang="ts">
132
+ import { FButton } from 'fantasia-ui'
4
133
 
5
- *For detailed API usage, refer to [Secondary encapsulation based on el-upload to achieve multi-functional upload - CSDN Blog](https://blog.csdn.net/weixin_60818087/article/details/148193542?spm=1001.2014.3001.5502)*
134
+ const handleClick = () => {
135
+ console.log('clicked!')
136
+ }
137
+ </script>
138
+
139
+ <template>
140
+ <FButton type="primary" @click="handleClick">
141
+ Primary Button
142
+ </FButton>
143
+ <FButton type="success">Success Button</FButton>
144
+ <FButton type="warning">Warning Button</FButton>
145
+ <FButton type="danger">Danger Button</FButton>
146
+ </template>
147
+ ```
6
148
 
7
- > Import styles in `main.ts`: `import 'fantasia-ui/dist/index.css'`
8
- >
9
- > Missing icons? You need to install **Element-plus** icons for them to display.
149
+ ### Upload Component
10
150
 
11
151
  ```vue
12
- <script lang="ts">
13
- import { FUpload } from 'fantasia-ui';
14
-
15
- export default {
16
- components: {
17
- FUpload
18
- },
19
- methods: {
20
- handleUpload: (file, done, error) => {
21
- try {
22
- console.log(file);
23
- done();
24
- } catch (err) {
25
- error(err);
26
- }
27
- }
28
- }
152
+ <script setup lang="ts">
153
+ import { FUpload } from 'fantasia-ui'
154
+
155
+ const handleUpload = (file: File, done: () => void, error: (err: any) => void) => {
156
+ try {
157
+ // Upload logic
158
+ console.log('Upload file:', file)
159
+ done()
160
+ } catch (err) {
161
+ error(err)
162
+ }
29
163
  }
30
164
  </script>
31
165
 
32
166
  <template>
33
- <FUpload crop mosaic @upload="handleUpload" />
167
+ <FUpload
168
+ crop
169
+ mosaic
170
+ @upload="handleUpload"
171
+ />
34
172
  </template>
35
173
  ```
36
174
 
37
- ### Table Component
175
+ ### Pagination Component
38
176
 
39
177
  ```vue
40
- <script lang="ts" setup>
41
- import { FTable } from 'fantasia-ui';
42
- import type { Actions, Columns } from 'fantasia-ui/dist';
43
- import { reactive } from 'vue';
44
-
45
- const data = [
46
- {
47
- id: 1,
48
- nickname: 'Test User'
49
- }
50
- ]
51
-
52
- const columns = reactive<Columns[]>([
53
- {
54
- prop: 'id',
55
- label: 'ID'
56
- },
57
- {
58
- prop: 'nickname',
59
- label: 'Nickname'
60
- }
61
- ])
62
-
63
- const actions = reactive<Actions[]>([
64
- {
65
- action: 'switch',
66
- event: 'change',
67
- prop: 'change',
68
- config: {
69
- activeText: 'Enable',
70
- inactiveText: 'Disable',
71
- activeValue: 0,
72
- inactiveValue: 1
73
- }
74
- },
75
- {
76
- action: 'button',
77
- event: 'delete',
78
- label: 'Delete',
79
- type: 'danger',
80
- icon: 'delete'
81
- }
82
- ])
83
-
84
- const handleAction = (row: any, event: string) => {
85
- switch (event) {
86
- case 'change':
87
- console.log("Switched");
88
- break;
89
- case 'delete':
90
- console.log("Deleted");
91
- break;
92
- }
178
+ <script setup lang="ts">
179
+ import { FPagination } from 'fantasia-ui'
180
+ import { ref } from 'vue'
181
+
182
+ const currentPage = ref(1)
183
+ const pageSize = ref(10)
184
+ const total = ref(100)
185
+
186
+ const handlePageChange = (page: number) => {
187
+ currentPage.value = page
188
+ console.log('Current page:', page)
93
189
  }
94
190
  </script>
95
191
 
96
192
  <template>
97
- <FTable :data="data" :columns="columns" :actions="actions" @action="handleAction">
98
- <template #id="{ row }">
99
- <h1>{{ row }}</h1>
100
- </template>
101
- </FTable>
193
+ <FPagination
194
+ v-model:current-page="currentPage"
195
+ v-model:page-size="pageSize"
196
+ :total="total"
197
+ @change="handlePageChange"
198
+ />
199
+ </template>
200
+ ```
201
+
202
+ ### Layout Components
203
+
204
+ ```vue
205
+ <script setup lang="ts">
206
+ import { FRow, FCol, FSpace } from 'fantasia-ui'
207
+ </script>
208
+
209
+ <template>
210
+ <!-- Grid Layout -->
211
+ <FRow :gutter="20">
212
+ <FCol :span="12">Column 1</FCol>
213
+ <FCol :span="12">Column 2</FCol>
214
+ </FRow>
215
+
216
+ <!-- Space Layout -->
217
+ <FSpace direction="horizontal" :size="16">
218
+ <FButton>Button 1</FButton>
219
+ <FButton>Button 2</FButton>
220
+ <FButton>Button 3</FButton>
221
+ </FSpace>
102
222
  </template>
103
- ```
223
+ ```
224
+
225
+ ## 🎨 Theme Customization
226
+
227
+ The component library supports theme customization via CSS variables:
228
+
229
+ ```css
230
+ :root {
231
+ --primary-color: #409eff;
232
+ --success-color: #67c23a;
233
+ --warning-color: #e6a23c;
234
+ --danger-color: #f56c6c;
235
+ --info-color: #909399;
236
+ }
237
+ ```
238
+
239
+ ## 📖 TypeScript Support
240
+
241
+ Fantasia UI provides complete TypeScript type definitions:
242
+
243
+ ```typescript
244
+ import type {
245
+ FButtonProps,
246
+ FInputProps,
247
+ FAvatarProps,
248
+ // ... other types
249
+ } from 'fantasia-ui'
250
+
251
+ // Use types
252
+ const buttonProps: FButtonProps = {
253
+ type: 'primary',
254
+ size: 'large',
255
+ disabled: false
256
+ }
257
+ ```
258
+
259
+ ## 🔗 Links
260
+
261
+ - [Changelog](./CHANGELOG.md)
262
+ - [Optimization Report](./OPTIMIZATION.md)
263
+ - [Issues](https://github.com/shuster/fantasia-ui/issues)
264
+ - [Contributing Guide](./CONTRIBUTING.md)
265
+
266
+ ## 📄 License
267
+
268
+ [MIT](./LICENSE) License © 2024 Shuster
269
+
270
+ ## 🤝 Contributing
271
+
272
+ Issues and Pull Requests are welcome!
273
+
274
+ If this project helps you, please give it a ⭐️ Star!
package/README.md CHANGED
@@ -1,103 +1,274 @@
1
- # Fantasia UI 组件库
1
+ # Fantasia UI
2
2
 
3
- ### Upload 组件
3
+ <p align="center">
4
+ <img src="https://img.shields.io/npm/v/fantasia-ui" alt="npm version">
5
+ <img src="https://img.shields.io/npm/dm/fantasia-ui" alt="npm downloads">
6
+ <img src="https://img.shields.io/npm/l/fantasia-ui" alt="license">
7
+ <img src="https://img.shields.io/badge/vue-3.x-brightgreen.svg" alt="vue3">
8
+ </p>
4
9
 
5
- *详细Api使用方法参考 [基于 el-upload 二次封装,实现多功能上传-CSDN博客](https://blog.csdn.net/weixin_60818087/article/details/148193542?spm=1001.2014.3001.5502)*
10
+ <p align="center">
11
+ 一个基于 Vue 3 + TypeScript 的现代化 UI 组件库
12
+ </p>
6
13
 
7
- > main.ts 引入样式 import 'fantasia-ui/dist/index.css'
8
- >
9
- > 发现没有图标?需要安装 **Element-plus** 的 icon 才会显示图标
14
+ <p align="center">
15
+ <a href="./README.en.md">English</a> | 简体中文
16
+ </p>
17
+
18
+ ## ✨ 特性
19
+
20
+ - 🎨 **现代化设计** - 简洁优雅的设计风格
21
+ - 🔧 **TypeScript** - 完整的类型定义支持
22
+ - 📦 **按需加载** - 支持 Tree Shaking,减小打包体积
23
+ - ⚡ **Vue 3** - 基于 Vue 3 Composition API
24
+ - 🎯 **开箱即用** - 丰富的组件,满足日常开发需求
25
+ - 📱 **响应式** - 移动端友好的交互体验
26
+
27
+ ## 📦 安装
28
+
29
+ ```bash
30
+ # npm
31
+ npm install fantasia-ui
32
+
33
+ # yarn
34
+ yarn add fantasia-ui
35
+
36
+ # pnpm
37
+ pnpm add fantasia-ui
38
+ ```
39
+
40
+ ### 可选依赖
41
+
42
+ 如果你需要使用图标组件,需要额外安装:
43
+
44
+ ```bash
45
+ # 安装图标库(可选)
46
+ npm install @vicons/ionicons5
47
+
48
+ # 如果使用了 VueUse 相关功能(可选)
49
+ npm install @vueuse/core
50
+ ```
51
+
52
+ ## 🔨 快速开始
53
+
54
+ ### 全局注册
55
+
56
+ ```typescript
57
+ // main.ts
58
+ import { createApp } from 'vue'
59
+ import FantasiaUI, { install } from 'fantasia-ui'
60
+ import 'fantasia-ui/dist/index.css'
61
+ import App from './App.vue'
62
+
63
+ const app = createApp(App)
64
+ app.use(install)
65
+ app.mount('#app')
66
+ ```
67
+
68
+ ### 按需引入
10
69
 
11
70
  ```vue
12
- <script lang="ts">
13
- import { FUpload } from 'fantasia-ui';
14
-
15
- export default {
16
- components: {
17
- FUpload
18
- },
19
- methods: {
20
- handleUpload: (file, done, error) => {
21
- try {
22
- console.log(file);
23
- done();
24
- } catch (err) {
25
- error(err);
26
- }
27
- }
28
- }
71
+ <script setup lang="ts">
72
+ import { FButton, FInput } from 'fantasia-ui'
73
+ import 'fantasia-ui/dist/index.css'
74
+ </script>
75
+
76
+ <template>
77
+ <FButton type="primary">按钮</FButton>
78
+ <FInput v-model="value" placeholder="请输入" />
79
+ </template>
80
+ ```
81
+
82
+ ## 📚 组件列表
83
+
84
+ ### 基础组件
85
+ - **FButton** - 按钮
86
+ - **FIcon** - 图标
87
+ - **FText** - 文本
88
+ - **FLink** - 链接
89
+ - **FTypography** - 排版
90
+
91
+ ### 布局组件
92
+ - **FContainer** - 容器
93
+ - **FRow** - 行
94
+ - **FCol** - 列
95
+ - **FSpace** - 间距
96
+ - **FDivider** - 分割线
97
+
98
+ ### 数据展示
99
+ - **FCard** - 卡片
100
+ - **FImage** - 图片
101
+ - **FAvatar** - 头像
102
+ - **FBadge** - 徽章
103
+ - **FTag** - 标签
104
+ - **FProgress** - 进度条
105
+ - **FRate** - 评分
106
+ - **FBreadcrumb** - 面包屑
107
+
108
+ ### 表单组件
109
+ - **FInput** - 输入框
110
+ - **FSelect** - 选择器
111
+ - **FUpload** - 上传
112
+
113
+ ### 数据组件
114
+ - **FPagination** - 分页
115
+ - **FTabs** - 标签页
116
+
117
+ ### 反馈组件
118
+ - **FLoading** - 加载
119
+ - **FTooltip** - 提示
120
+ - **FSliderCaptcha** - 滑块验证
121
+
122
+ ### 其他
123
+ - **FDropdown** - 下拉菜单
124
+ - **FAffix** - 固钉
125
+
126
+ ## 📝 使用示例
127
+
128
+ ### 按钮组件
129
+
130
+ ```vue
131
+ <script setup lang="ts">
132
+ import { FButton } from 'fantasia-ui'
133
+
134
+ const handleClick = () => {
135
+ console.log('clicked!')
29
136
  }
30
137
  </script>
31
138
 
32
139
  <template>
33
- <FUpload crop mosaic @upload="handleUplaod" />
140
+ <FButton type="primary" @click="handleClick">
141
+ 主要按钮
142
+ </FButton>
143
+ <FButton type="success">成功按钮</FButton>
144
+ <FButton type="warning">警告按钮</FButton>
145
+ <FButton type="danger">危险按钮</FButton>
34
146
  </template>
35
147
  ```
36
148
 
37
- ### Table 组件
149
+ ### 上传组件
38
150
 
39
151
  ```vue
40
- <script lang="ts" setup>
41
- import { FTable } from 'fantasia-ui';
42
- import type { Actions, Columns } from 'fantasia-ui/dist';
43
- import { reactive } from 'vue';
44
-
45
- const data = [
46
- {
47
- id: 1,
48
- nickname: '测试用户'
49
- }
50
- ]
51
-
52
- const columns = reactive<Columns[]>([
53
- {
54
- prop: 'id',
55
- label: 'ID'
56
- },
57
- {
58
- prop: 'nickname',
59
- label: '昵称'
60
- }
61
- ])
62
-
63
- const actions = reactive<Actions[]>([
64
- {
65
- action: 'switch',
66
- event: 'change',
67
- prop: 'change',
68
- config: {
69
- activeText: '启用',
70
- inactiveText: '禁用',
71
- activeValue: 0,
72
- inactiveValue: 1
73
- }
74
- },
75
- {
76
- action: 'button',
77
- event: 'delete',
78
- label: '删除',
79
- type: 'danger',
80
- icon: 'delete'
81
- }
82
- ])
83
-
84
- const handleAction = (row: any, event: string) => {
85
- switch (event) {
86
- case 'change':
87
- console.log("切换了");
88
- break;
89
- case 'delete':
90
- console.log("删除了");
91
- break;
152
+ <script setup lang="ts">
153
+ import { FUpload } from 'fantasia-ui'
154
+
155
+ const handleUpload = (file: File, done: () => void, error: (err: any) => void) => {
156
+ try {
157
+ // 上传逻辑
158
+ console.log('上传文件:', file)
159
+ done()
160
+ } catch (err) {
161
+ error(err)
92
162
  }
93
163
  }
94
164
  </script>
95
165
 
96
166
  <template>
97
- <FTable :data="data" :columns="columns" :actions="actions" @action="handleAction">
98
- <template #id="{ row }">
99
- <h1>{{ row }}</h1>
100
- </template>
101
- </FTable>
167
+ <FUpload
168
+ crop
169
+ mosaic
170
+ @upload="handleUpload"
171
+ />
172
+ </template>
173
+ ```
174
+
175
+ ### 分页组件
176
+
177
+ ```vue
178
+ <script setup lang="ts">
179
+ import { FPagination } from 'fantasia-ui'
180
+ import { ref } from 'vue'
181
+
182
+ const currentPage = ref(1)
183
+ const pageSize = ref(10)
184
+ const total = ref(100)
185
+
186
+ const handlePageChange = (page: number) => {
187
+ currentPage.value = page
188
+ console.log('当前页:', page)
189
+ }
190
+ </script>
191
+
192
+ <template>
193
+ <FPagination
194
+ v-model:current-page="currentPage"
195
+ v-model:page-size="pageSize"
196
+ :total="total"
197
+ @change="handlePageChange"
198
+ />
199
+ </template>
200
+ ```
201
+
202
+ ### 布局组件
203
+
204
+ ```vue
205
+ <script setup lang="ts">
206
+ import { FRow, FCol, FSpace } from 'fantasia-ui'
207
+ </script>
208
+
209
+ <template>
210
+ <!-- 栅格布局 -->
211
+ <FRow :gutter="20">
212
+ <FCol :span="12">列 1</FCol>
213
+ <FCol :span="12">列 2</FCol>
214
+ </FRow>
215
+
216
+ <!-- 间距布局 -->
217
+ <FSpace direction="horizontal" :size="16">
218
+ <FButton>按钮 1</FButton>
219
+ <FButton>按钮 2</FButton>
220
+ <FButton>按钮 3</FButton>
221
+ </FSpace>
102
222
  </template>
103
- ```
223
+ ```
224
+
225
+ ## 🎨 主题定制
226
+
227
+ 组件库支持 CSS 变量自定义主题:
228
+
229
+ ```css
230
+ :root {
231
+ --primary-color: #409eff;
232
+ --success-color: #67c23a;
233
+ --warning-color: #e6a23c;
234
+ --danger-color: #f56c6c;
235
+ --info-color: #909399;
236
+ }
237
+ ```
238
+
239
+ ## 📖 TypeScript 支持
240
+
241
+ Fantasia UI 提供完整的 TypeScript 类型定义:
242
+
243
+ ```typescript
244
+ import type {
245
+ FButtonProps,
246
+ FInputProps,
247
+ FAvatarProps,
248
+ // ... 其他类型
249
+ } from 'fantasia-ui'
250
+
251
+ // 使用类型
252
+ const buttonProps: FButtonProps = {
253
+ type: 'primary',
254
+ size: 'large',
255
+ disabled: false
256
+ }
257
+ ```
258
+
259
+ ## 🔗 相关链接
260
+
261
+ - [更新日志(中文)](./CHANGELOG.zh-CN.md)
262
+ - [更新日志(English)](./CHANGELOG.md)
263
+ - [优化报告](./OPTIMIZATION.md)
264
+ - [问题反馈](https://github.com/shuster/fantasia-ui/issues)
265
+
266
+ ## 📄 开源协议
267
+
268
+ [MIT](./LICENSE) License © 2024 Shuster
269
+
270
+ ## 🤝 贡献
271
+
272
+ 欢迎提交 Issue 和 Pull Request!
273
+
274
+ 如果这个项目对你有帮助,请给一个 ⭐️ Star 支持一下!