fantasia-ui 0.1.31 → 0.2.2

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 (152) hide show
  1. package/README.en.md +242 -84
  2. package/README.md +241 -83
  3. package/dist/assets/index.d.ts +5 -0
  4. package/dist/components/index.d.ts +27 -3
  5. package/dist/components/modules/FAffix.vue.d.ts +21 -0
  6. package/dist/components/modules/FAvatar.vue.d.ts +6 -0
  7. package/dist/components/modules/FBadge.vue.d.ts +24 -0
  8. package/dist/components/modules/FBreadcrumb.vue.d.ts +24 -0
  9. package/dist/components/modules/FButton.vue.d.ts +21 -0
  10. package/dist/components/modules/FCard.vue.d.ts +31 -0
  11. package/dist/components/modules/FCol.vue.d.ts +22 -0
  12. package/dist/components/modules/FContainer.vue.d.ts +20 -0
  13. package/dist/components/modules/FDivider.vue.d.ts +6 -0
  14. package/dist/components/modules/FDropdown.vue.d.ts +35 -0
  15. package/dist/components/modules/FIcon.vue.d.ts +20 -0
  16. package/dist/components/modules/FImage.vue.d.ts +23 -0
  17. package/dist/components/modules/FInput.vue.d.ts +27 -0
  18. package/dist/components/modules/FLink.vue.d.ts +21 -0
  19. package/dist/components/modules/FLoading.vue.d.ts +6 -0
  20. package/dist/components/modules/FPagination.vue.d.ts +16 -0
  21. package/dist/components/modules/FProgress.vue.d.ts +6 -0
  22. package/dist/components/modules/FRate.vue.d.ts +22 -0
  23. package/dist/components/modules/FRow.vue.d.ts +24 -0
  24. package/dist/components/modules/FSelect.vue.d.ts +17 -0
  25. package/dist/components/modules/FSpace.vue.d.ts +9 -0
  26. package/dist/components/modules/FTabs.vue.d.ts +24 -0
  27. package/dist/components/modules/FTag.vue.d.ts +25 -0
  28. package/dist/components/modules/FText.vue.d.ts +22 -0
  29. package/dist/components/modules/FTooltip.vue.d.ts +31 -0
  30. package/dist/components/modules/FTypography.vue.d.ts +22 -0
  31. package/dist/fantasia-ui.es.js +1556 -34405
  32. package/dist/fantasia-ui.umd.js +2 -62
  33. package/dist/index.css +1 -1
  34. package/dist/index.d.ts +1 -3
  35. package/dist/types/assets/index.d.ts +5 -0
  36. package/dist/types/assets/index.js +5 -0
  37. package/dist/types/components/index.d.ts +27 -0
  38. package/dist/types/components/index.js +27 -0
  39. package/dist/types/components/modules/base.d.ts +7 -0
  40. package/dist/types/components/modules/f-affix.d.ts +5 -0
  41. package/dist/types/components/modules/f-avatar.d.ts +10 -0
  42. package/dist/types/components/modules/f-badge.d.ts +9 -0
  43. package/dist/types/components/modules/f-breadcrumb.d.ts +10 -0
  44. package/dist/types/components/modules/f-button.d.ts +9 -0
  45. package/dist/types/components/modules/f-card.d.ts +6 -0
  46. package/dist/types/components/modules/f-col.d.ts +15 -0
  47. package/dist/types/components/modules/f-container.d.ts +4 -0
  48. package/dist/types/components/modules/f-dialog.d.ts +6 -0
  49. package/dist/types/components/modules/f-divider.d.ts +8 -0
  50. package/dist/types/components/modules/f-dropdown.d.ts +17 -0
  51. package/dist/types/components/modules/f-form.d.ts +83 -0
  52. package/dist/types/components/modules/f-icon.d.ts +5 -0
  53. package/dist/types/components/modules/f-image.d.ts +8 -0
  54. package/dist/types/components/modules/f-input.d.ts +9 -0
  55. package/dist/types/components/modules/f-link.d.ts +8 -0
  56. package/dist/types/components/modules/f-loading.d.ts +6 -0
  57. package/dist/types/components/modules/f-menu.d.ts +13 -0
  58. package/dist/types/components/modules/f-pagination.d.ts +6 -0
  59. package/dist/types/components/modules/f-progress.d.ts +7 -0
  60. package/dist/types/components/modules/f-rate.d.ts +12 -0
  61. package/dist/types/components/modules/f-row.d.ts +9 -0
  62. package/dist/types/components/modules/f-slider-captcha.d.ts +16 -0
  63. package/dist/types/components/modules/f-space.d.ts +11 -0
  64. package/dist/types/components/modules/f-table.d.ts +12 -0
  65. package/dist/types/components/modules/f-tabs.d.ts +12 -0
  66. package/dist/types/components/modules/f-tag.d.ts +10 -0
  67. package/dist/types/components/modules/f-tagsview.d.ts +7 -0
  68. package/dist/types/components/modules/f-text.d.ts +10 -0
  69. package/dist/types/components/modules/f-toolbar.d.ts +26 -0
  70. package/dist/types/components/modules/f-tooltip.d.ts +10 -0
  71. package/dist/types/components/modules/f-upload.d.ts +11 -0
  72. package/dist/types/index.d.ts +4 -2
  73. package/dist/types/index.js +15 -0
  74. package/dist/types/models/index.d.ts +26 -0
  75. package/dist/types/types/components/index.d.ts +32 -0
  76. package/dist/types/types/components/index.js +32 -0
  77. package/dist/types/types/components/modules/base.d.ts +7 -0
  78. package/dist/types/types/components/modules/base.js +1 -0
  79. package/dist/types/types/components/modules/f-affix.d.ts +5 -0
  80. package/dist/types/types/components/modules/f-affix.js +1 -0
  81. package/dist/types/types/components/modules/f-avatar.d.ts +10 -0
  82. package/dist/types/types/components/modules/f-avatar.js +1 -0
  83. package/dist/types/types/components/modules/f-badge.d.ts +9 -0
  84. package/dist/types/types/components/modules/f-badge.js +1 -0
  85. package/dist/types/types/components/modules/f-breadcrumb.d.ts +10 -0
  86. package/dist/types/types/components/modules/f-breadcrumb.js +1 -0
  87. package/dist/types/types/components/modules/f-button.d.ts +9 -0
  88. package/dist/types/types/components/modules/f-button.js +1 -0
  89. package/dist/types/types/components/modules/f-card.d.ts +6 -0
  90. package/dist/types/types/components/modules/f-card.js +1 -0
  91. package/dist/types/types/components/modules/f-col.d.ts +15 -0
  92. package/dist/types/types/components/modules/f-col.js +1 -0
  93. package/dist/types/types/components/modules/f-container.d.ts +4 -0
  94. package/dist/types/types/components/modules/f-container.js +1 -0
  95. package/dist/types/types/components/modules/f-dialog.d.ts +6 -0
  96. package/dist/types/types/components/modules/f-dialog.js +1 -0
  97. package/dist/types/types/components/modules/f-divider.d.ts +8 -0
  98. package/dist/types/types/components/modules/f-divider.js +1 -0
  99. package/dist/types/types/components/modules/f-dropdown.d.ts +17 -0
  100. package/dist/types/types/components/modules/f-dropdown.js +1 -0
  101. package/dist/types/types/components/modules/f-form.d.ts +83 -0
  102. package/dist/types/types/components/modules/f-form.js +1 -0
  103. package/dist/types/types/components/modules/f-icon.d.ts +5 -0
  104. package/dist/types/types/components/modules/f-icon.js +1 -0
  105. package/dist/types/types/components/modules/f-image.d.ts +8 -0
  106. package/dist/types/types/components/modules/f-image.js +1 -0
  107. package/dist/types/types/components/modules/f-input.d.ts +9 -0
  108. package/dist/types/types/components/modules/f-input.js +1 -0
  109. package/dist/types/types/components/modules/f-link.d.ts +8 -0
  110. package/dist/types/types/components/modules/f-link.js +1 -0
  111. package/dist/types/types/components/modules/f-loading.d.ts +6 -0
  112. package/dist/types/types/components/modules/f-loading.js +1 -0
  113. package/dist/types/types/components/modules/f-menu.d.ts +13 -0
  114. package/dist/types/types/components/modules/f-menu.js +1 -0
  115. package/dist/types/types/components/modules/f-pagination.d.ts +6 -0
  116. package/dist/types/types/components/modules/f-pagination.js +1 -0
  117. package/dist/types/types/components/modules/f-progress.d.ts +7 -0
  118. package/dist/types/types/components/modules/f-progress.js +1 -0
  119. package/dist/types/types/components/modules/f-rate.d.ts +12 -0
  120. package/dist/types/types/components/modules/f-rate.js +1 -0
  121. package/dist/types/types/components/modules/f-row.d.ts +9 -0
  122. package/dist/types/types/components/modules/f-row.js +1 -0
  123. package/dist/types/types/components/modules/f-slider-captcha.d.ts +16 -0
  124. package/dist/types/types/components/modules/f-slider-captcha.js +2 -0
  125. package/dist/types/types/components/modules/f-space.d.ts +11 -0
  126. package/dist/types/types/components/modules/f-space.js +1 -0
  127. package/dist/types/types/components/modules/f-table.d.ts +12 -0
  128. package/dist/types/types/components/modules/f-table.js +1 -0
  129. package/dist/types/types/components/modules/f-tabs.d.ts +12 -0
  130. package/dist/types/types/components/modules/f-tabs.js +1 -0
  131. package/dist/types/types/components/modules/f-tag.d.ts +10 -0
  132. package/dist/types/types/components/modules/f-tag.js +1 -0
  133. package/dist/types/types/components/modules/f-tagsview.d.ts +7 -0
  134. package/dist/types/types/components/modules/f-tagsview.js +1 -0
  135. package/dist/types/types/components/modules/f-text.d.ts +10 -0
  136. package/dist/types/types/components/modules/f-text.js +1 -0
  137. package/dist/types/types/components/modules/f-toolbar.d.ts +26 -0
  138. package/dist/types/types/components/modules/f-toolbar.js +1 -0
  139. package/dist/types/types/components/modules/f-tooltip.d.ts +10 -0
  140. package/dist/types/types/components/modules/f-tooltip.js +1 -0
  141. package/dist/types/types/components/modules/f-upload.d.ts +11 -0
  142. package/dist/types/types/components/modules/f-upload.js +1 -0
  143. package/dist/types/types/index.d.ts +2 -0
  144. package/dist/types/types/index.js +2 -0
  145. package/dist/types/types/models/index.d.ts +26 -0
  146. package/dist/types/types/models/index.js +1 -0
  147. package/package.json +15 -11
  148. package/dist/components/modules/FTable.vue.d.ts +0 -153
  149. package/dist/components/modules/FUpload.vue.d.ts +0 -1428
  150. package/dist/favicon.ico +0 -0
  151. package/dist/types/modules/f-table.d.ts +0 -64
  152. package/dist/types/modules/f-upload.d.ts +0 -15
package/README.en.md CHANGED
@@ -1,103 +1,261 @@
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
+ ```
4
39
 
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)*
40
+ ## 🔨 Quick Start
6
41
 
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.
42
+ ### Global Registration
43
+
44
+ ```typescript
45
+ // main.ts
46
+ import { createApp } from 'vue'
47
+ import FantasiaUI, { install } from 'fantasia-ui'
48
+ import 'fantasia-ui/dist/index.css'
49
+ import App from './App.vue'
50
+
51
+ const app = createApp(App)
52
+ app.use(install)
53
+ app.mount('#app')
54
+ ```
55
+
56
+ ### Import on Demand
10
57
 
11
58
  ```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
- }
59
+ <script setup lang="ts">
60
+ import { FButton, FInput } from 'fantasia-ui'
61
+ import 'fantasia-ui/dist/index.css'
62
+ </script>
63
+
64
+ <template>
65
+ <FButton type="primary">Button</FButton>
66
+ <FInput v-model="value" placeholder="Please input" />
67
+ </template>
68
+ ```
69
+
70
+ ## 📚 Component List
71
+
72
+ ### Basic Components
73
+ - **FButton** - Button
74
+ - **FIcon** - Icon
75
+ - **FText** - Text
76
+ - **FLink** - Link
77
+ - **FTypography** - Typography
78
+
79
+ ### Layout Components
80
+ - **FContainer** - Container
81
+ - **FRow** - Row
82
+ - **FCol** - Column
83
+ - **FSpace** - Space
84
+ - **FDivider** - Divider
85
+
86
+ ### Data Display
87
+ - **FCard** - Card
88
+ - **FImage** - Image
89
+ - **FAvatar** - Avatar
90
+ - **FBadge** - Badge
91
+ - **FTag** - Tag
92
+ - **FProgress** - Progress
93
+ - **FRate** - Rate
94
+ - **FBreadcrumb** - Breadcrumb
95
+
96
+ ### Form Components
97
+ - **FInput** - Input
98
+ - **FSelect** - Select
99
+ - **FUpload** - Upload
100
+
101
+ ### Data Components
102
+ - **FPagination** - Pagination
103
+ - **FTabs** - Tabs
104
+
105
+ ### Feedback Components
106
+ - **FLoading** - Loading
107
+ - **FTooltip** - Tooltip
108
+ - **FSliderCaptcha** - Slider Captcha
109
+
110
+ ### Others
111
+ - **FDropdown** - Dropdown
112
+ - **FAffix** - Affix
113
+
114
+ ## 📝 Usage Examples
115
+
116
+ ### Button Component
117
+
118
+ ```vue
119
+ <script setup lang="ts">
120
+ import { FButton } from 'fantasia-ui'
121
+
122
+ const handleClick = () => {
123
+ console.log('clicked!')
29
124
  }
30
125
  </script>
31
126
 
32
127
  <template>
33
- <FUpload crop mosaic @upload="handleUpload" />
128
+ <FButton type="primary" @click="handleClick">
129
+ Primary Button
130
+ </FButton>
131
+ <FButton type="success">Success Button</FButton>
132
+ <FButton type="warning">Warning Button</FButton>
133
+ <FButton type="danger">Danger Button</FButton>
34
134
  </template>
35
135
  ```
36
136
 
37
- ### Table Component
137
+ ### Upload Component
38
138
 
39
139
  ```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
- }
140
+ <script setup lang="ts">
141
+ import { FUpload } from 'fantasia-ui'
142
+
143
+ const handleUpload = (file: File, done: () => void, error: (err: any) => void) => {
144
+ try {
145
+ // Upload logic
146
+ console.log('Upload file:', file)
147
+ done()
148
+ } catch (err) {
149
+ error(err)
150
+ }
93
151
  }
94
152
  </script>
95
153
 
96
154
  <template>
97
- <FTable :data="data" :columns="columns" :actions="actions" @action="handleAction">
98
- <template #id="{ row }">
99
- <h1>{{ row }}</h1>
100
- </template>
101
- </FTable>
155
+ <FUpload
156
+ crop
157
+ mosaic
158
+ @upload="handleUpload"
159
+ />
102
160
  </template>
103
- ```
161
+ ```
162
+
163
+ ### Pagination Component
164
+
165
+ ```vue
166
+ <script setup lang="ts">
167
+ import { FPagination } from 'fantasia-ui'
168
+ import { ref } from 'vue'
169
+
170
+ const currentPage = ref(1)
171
+ const pageSize = ref(10)
172
+ const total = ref(100)
173
+
174
+ const handlePageChange = (page: number) => {
175
+ currentPage.value = page
176
+ console.log('Current page:', page)
177
+ }
178
+ </script>
179
+
180
+ <template>
181
+ <FPagination
182
+ v-model:current-page="currentPage"
183
+ v-model:page-size="pageSize"
184
+ :total="total"
185
+ @change="handlePageChange"
186
+ />
187
+ </template>
188
+ ```
189
+
190
+ ### Layout Components
191
+
192
+ ```vue
193
+ <script setup lang="ts">
194
+ import { FRow, FCol, FSpace } from 'fantasia-ui'
195
+ </script>
196
+
197
+ <template>
198
+ <!-- Grid Layout -->
199
+ <FRow :gutter="20">
200
+ <FCol :span="12">Column 1</FCol>
201
+ <FCol :span="12">Column 2</FCol>
202
+ </FRow>
203
+
204
+ <!-- Space Layout -->
205
+ <FSpace direction="horizontal" :size="16">
206
+ <FButton>Button 1</FButton>
207
+ <FButton>Button 2</FButton>
208
+ <FButton>Button 3</FButton>
209
+ </FSpace>
210
+ </template>
211
+ ```
212
+
213
+ ## 🎨 Theme Customization
214
+
215
+ The component library supports theme customization via CSS variables:
216
+
217
+ ```css
218
+ :root {
219
+ --primary-color: #409eff;
220
+ --success-color: #67c23a;
221
+ --warning-color: #e6a23c;
222
+ --danger-color: #f56c6c;
223
+ --info-color: #909399;
224
+ }
225
+ ```
226
+
227
+ ## 📖 TypeScript Support
228
+
229
+ Fantasia UI provides complete TypeScript type definitions:
230
+
231
+ ```typescript
232
+ import type {
233
+ FButtonProps,
234
+ FInputProps,
235
+ FAvatarProps,
236
+ // ... other types
237
+ } from 'fantasia-ui'
238
+
239
+ // Use types
240
+ const buttonProps: FButtonProps = {
241
+ type: 'primary',
242
+ size: 'large',
243
+ disabled: false
244
+ }
245
+ ```
246
+
247
+ ## 🔗 Links
248
+
249
+ - [Changelog](./CHANGELOG.md)
250
+ - [Issues](https://github.com/yourusername/fantasia-ui/issues)
251
+ - [Contributing Guide](./CONTRIBUTING.md)
252
+
253
+ ## 📄 License
254
+
255
+ [MIT](./LICENSE) License © 2024 Shuster
256
+
257
+ ## 🤝 Contributing
258
+
259
+ Issues and Pull Requests are welcome!
260
+
261
+ If this project helps you, please give it a ⭐️ Star!
package/README.md CHANGED
@@ -1,103 +1,261 @@
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
+ ```typescript
45
+ // main.ts
46
+ import { createApp } from 'vue'
47
+ import FantasiaUI, { install } from 'fantasia-ui'
48
+ import 'fantasia-ui/dist/index.css'
49
+ import App from './App.vue'
50
+
51
+ const app = createApp(App)
52
+ app.use(install)
53
+ app.mount('#app')
54
+ ```
55
+
56
+ ### 按需引入
10
57
 
11
58
  ```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
- }
59
+ <script setup lang="ts">
60
+ import { FButton, FInput } from 'fantasia-ui'
61
+ import 'fantasia-ui/dist/index.css'
62
+ </script>
63
+
64
+ <template>
65
+ <FButton type="primary">按钮</FButton>
66
+ <FInput v-model="value" placeholder="请输入" />
67
+ </template>
68
+ ```
69
+
70
+ ## 📚 组件列表
71
+
72
+ ### 基础组件
73
+ - **FButton** - 按钮
74
+ - **FIcon** - 图标
75
+ - **FText** - 文本
76
+ - **FLink** - 链接
77
+ - **FTypography** - 排版
78
+
79
+ ### 布局组件
80
+ - **FContainer** - 容器
81
+ - **FRow** - 行
82
+ - **FCol** - 列
83
+ - **FSpace** - 间距
84
+ - **FDivider** - 分割线
85
+
86
+ ### 数据展示
87
+ - **FCard** - 卡片
88
+ - **FImage** - 图片
89
+ - **FAvatar** - 头像
90
+ - **FBadge** - 徽章
91
+ - **FTag** - 标签
92
+ - **FProgress** - 进度条
93
+ - **FRate** - 评分
94
+ - **FBreadcrumb** - 面包屑
95
+
96
+ ### 表单组件
97
+ - **FInput** - 输入框
98
+ - **FSelect** - 选择器
99
+ - **FUpload** - 上传
100
+
101
+ ### 数据组件
102
+ - **FPagination** - 分页
103
+ - **FTabs** - 标签页
104
+
105
+ ### 反馈组件
106
+ - **FLoading** - 加载
107
+ - **FTooltip** - 提示
108
+ - **FSliderCaptcha** - 滑块验证
109
+
110
+ ### 其他
111
+ - **FDropdown** - 下拉菜单
112
+ - **FAffix** - 固钉
113
+
114
+ ## 📝 使用示例
115
+
116
+ ### 按钮组件
117
+
118
+ ```vue
119
+ <script setup lang="ts">
120
+ import { FButton } from 'fantasia-ui'
121
+
122
+ const handleClick = () => {
123
+ console.log('clicked!')
29
124
  }
30
125
  </script>
31
126
 
32
127
  <template>
33
- <FUpload crop mosaic @upload="handleUplaod" />
128
+ <FButton type="primary" @click="handleClick">
129
+ 主要按钮
130
+ </FButton>
131
+ <FButton type="success">成功按钮</FButton>
132
+ <FButton type="warning">警告按钮</FButton>
133
+ <FButton type="danger">危险按钮</FButton>
34
134
  </template>
35
135
  ```
36
136
 
37
- ### Table 组件
137
+ ### 上传组件
38
138
 
39
139
  ```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;
140
+ <script setup lang="ts">
141
+ import { FUpload } from 'fantasia-ui'
142
+
143
+ const handleUpload = (file: File, done: () => void, error: (err: any) => void) => {
144
+ try {
145
+ // 上传逻辑
146
+ console.log('上传文件:', file)
147
+ done()
148
+ } catch (err) {
149
+ error(err)
92
150
  }
93
151
  }
94
152
  </script>
95
153
 
96
154
  <template>
97
- <FTable :data="data" :columns="columns" :actions="actions" @action="handleAction">
98
- <template #id="{ row }">
99
- <h1>{{ row }}</h1>
100
- </template>
101
- </FTable>
155
+ <FUpload
156
+ crop
157
+ mosaic
158
+ @upload="handleUpload"
159
+ />
102
160
  </template>
103
- ```
161
+ ```
162
+
163
+ ### 分页组件
164
+
165
+ ```vue
166
+ <script setup lang="ts">
167
+ import { FPagination } from 'fantasia-ui'
168
+ import { ref } from 'vue'
169
+
170
+ const currentPage = ref(1)
171
+ const pageSize = ref(10)
172
+ const total = ref(100)
173
+
174
+ const handlePageChange = (page: number) => {
175
+ currentPage.value = page
176
+ console.log('当前页:', page)
177
+ }
178
+ </script>
179
+
180
+ <template>
181
+ <FPagination
182
+ v-model:current-page="currentPage"
183
+ v-model:page-size="pageSize"
184
+ :total="total"
185
+ @change="handlePageChange"
186
+ />
187
+ </template>
188
+ ```
189
+
190
+ ### 布局组件
191
+
192
+ ```vue
193
+ <script setup lang="ts">
194
+ import { FRow, FCol, FSpace } from 'fantasia-ui'
195
+ </script>
196
+
197
+ <template>
198
+ <!-- 栅格布局 -->
199
+ <FRow :gutter="20">
200
+ <FCol :span="12">列 1</FCol>
201
+ <FCol :span="12">列 2</FCol>
202
+ </FRow>
203
+
204
+ <!-- 间距布局 -->
205
+ <FSpace direction="horizontal" :size="16">
206
+ <FButton>按钮 1</FButton>
207
+ <FButton>按钮 2</FButton>
208
+ <FButton>按钮 3</FButton>
209
+ </FSpace>
210
+ </template>
211
+ ```
212
+
213
+ ## 🎨 主题定制
214
+
215
+ 组件库支持 CSS 变量自定义主题:
216
+
217
+ ```css
218
+ :root {
219
+ --primary-color: #409eff;
220
+ --success-color: #67c23a;
221
+ --warning-color: #e6a23c;
222
+ --danger-color: #f56c6c;
223
+ --info-color: #909399;
224
+ }
225
+ ```
226
+
227
+ ## 📖 TypeScript 支持
228
+
229
+ Fantasia UI 提供完整的 TypeScript 类型定义:
230
+
231
+ ```typescript
232
+ import type {
233
+ FButtonProps,
234
+ FInputProps,
235
+ FAvatarProps,
236
+ // ... 其他类型
237
+ } from 'fantasia-ui'
238
+
239
+ // 使用类型
240
+ const buttonProps: FButtonProps = {
241
+ type: 'primary',
242
+ size: 'large',
243
+ disabled: false
244
+ }
245
+ ```
246
+
247
+ ## 🔗 相关链接
248
+
249
+ - [更新日志](./CHANGELOG.md)
250
+ - [问题反馈](https://github.com/yourusername/fantasia-ui/issues)
251
+ - [贡献指南](./CONTRIBUTING.md)
252
+
253
+ ## 📄 开源协议
254
+
255
+ [MIT](./LICENSE) License © 2024 Shuster
256
+
257
+ ## 🤝 贡献
258
+
259
+ 欢迎提交 Issue 和 Pull Request!
260
+
261
+ 如果这个项目对你有帮助,请给一个 ⭐️ Star 支持一下!
@@ -0,0 +1,5 @@
1
+ import { default as Theme } from './icons/theme-light-dark.svg';
2
+ import { default as ThemeDark } from './icons/theme-dark.svg';
3
+ import { default as ThemeLight } from './icons/theme-light.svg';
4
+ import { default as PictureError } from './icons/picture_error.svg';
5
+ export { Theme, ThemeDark, ThemeLight, PictureError };