little-dizzy 2.8.0 → 2.9.0

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 CHANGED
@@ -1,14 +1,45 @@
1
- # LittleDizzy
1
+ <p align="center">
2
+ <img src="https://img.shields.io/npm/v/little-dizzy?color=42b883&label=version" alt="version" />
3
+ <img src="https://img.shields.io/npm/l/little-dizzy?color=42b883" alt="license" />
4
+ <img src="https://img.shields.io/badge/vue-3.x-42b883" alt="vue" />
5
+ </p>
2
6
 
3
- 基于 Vue 3 的 UI 组件库,支持代码片段预览功能。
7
+ <h1 align="center">🎨 LittleDizzy</h1>
4
8
 
5
- ## 安装
9
+ <p align="center">
10
+ 一个轻量、优雅的 Vue 3 组件库,内置代码片段预览系统
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://gitee.com/nizuinande/little-dizzy">📖 文档</a> ·
15
+ <a href="https://gitee.com/nizuinande/little-dizzy/issues">🐛 反馈</a>
16
+ </p>
17
+
18
+ ---
19
+
20
+ ## ✨ 特性
21
+
22
+ - 🚀 **基于 Vue 3** - 使用 Composition API,完美支持 Vue 3 生态
23
+ - 📦 **开箱即用** - 提供丰富的基础组件和创意组件
24
+ - 🎯 **按需引入** - 支持 Tree-shaking,按需加载不冗余
25
+ - 💻 **代码片段系统** - 内置代码片段注册与展示功能
26
+ - 🎨 **精美动画** - 组件内置流畅的过渡动画效果
27
+ - 📱 **响应式设计** - 适配多种屏幕尺寸
28
+
29
+ ## 📦 安装
6
30
 
7
31
  ```bash
32
+ # npm
8
33
  npm install little-dizzy
34
+
35
+ # yarn
36
+ yarn add little-dizzy
37
+
38
+ # pnpm
39
+ pnpm add little-dizzy
9
40
  ```
10
41
 
11
- ## 使用方式
42
+ ## 🚀 快速开始
12
43
 
13
44
  ### 完整引入
14
45
 
@@ -16,6 +47,7 @@ npm install little-dizzy
16
47
  import { createApp } from 'vue'
17
48
  import LittleDizzy from 'little-dizzy'
18
49
  import 'little-dizzy/dist/styles/index.css'
50
+ import App from './App.vue'
19
51
 
20
52
  const app = createApp(App)
21
53
  app.use(LittleDizzy)
@@ -26,17 +58,51 @@ app.mount('#app')
26
58
 
27
59
  ```javascript
28
60
  import { createApp } from 'vue'
29
- import { Button, Card, Modal } from 'little-dizzy'
61
+ import { Button, Card, Modal, Message } from 'little-dizzy'
30
62
  import 'little-dizzy/dist/styles/index.css'
63
+ import App from './App.vue'
31
64
 
32
65
  const app = createApp(App)
33
- app.component('Button', Button)
34
- app.component('Card', Card)
35
- app.component('Modal', Modal)
66
+
67
+ // 注册需要的组件
68
+ app.component('LdButton', Button)
69
+ app.component('LdCard', Card)
70
+ app.component('LdModal', Modal)
71
+
36
72
  app.mount('#app')
37
73
  ```
38
74
 
39
- ## 组件列表
75
+ ## 📚 组件列表
76
+
77
+ ### 基础组件
78
+
79
+ | 组件 | 描述 |
80
+ |------|------|
81
+ | **Button** | 按钮组件,支持多种类型和尺寸 |
82
+ | **Card** | 卡片容器,支持头部、内容、底部插槽 |
83
+ | **Modal** | 模态框,支持自定义内容和动画效果 |
84
+ | **Message** | 消息提示,支持多种状态类型 |
85
+ | **Table** | 表格组件,支持自定义列和插槽 |
86
+ | **Carousel** | 轮播图组件,支持自动播放 |
87
+ | **Backtop** | 返回顶部按钮 |
88
+ | **Loading** | 加载状态指示器 |
89
+ | **LzImg** | 图片组件,支持预览、多图切换 |
90
+
91
+ ### 创意组件
92
+
93
+ | 组件 | 描述 |
94
+ |------|------|
95
+ | **ldFlipper** | 翻牌器动画组件 |
96
+ | **ldLinearCard** | 渐变边框卡片 |
97
+ | **ldThemeCard** | 主题切换卡片 |
98
+ | **ldWeather** | 天气展示组件 |
99
+ | **ldPrint** | 打字机效果组件 |
100
+ | **lzbutton** | 创意按钮组件 |
101
+ | **Lztext** | 文本动画组件 |
102
+ | **lztheme** | 主题控制组件 |
103
+ | **ldradio** | 创意单选组件 |
104
+
105
+ ## 🔧 组件示例
40
106
 
41
107
  ### Button 按钮
42
108
 
@@ -46,13 +112,15 @@ app.mount('#app')
46
112
  <Button type="success">成功按钮</Button>
47
113
  <Button type="warning">警告按钮</Button>
48
114
  <Button type="danger">危险按钮</Button>
115
+ <Button disabled>禁用按钮</Button>
49
116
  </template>
50
117
  ```
51
118
 
52
- **Props:**
53
- - `type`: 按钮类型,可选值 `primary` | `success` | `warning` | `danger` | `info` | `secondary`
54
- - `size`: 按钮尺寸,可选值 `small` | `medium` | `large`
55
- - `disabled`: 是否禁用
119
+ | 属性 | 说明 | 类型 | 默认值 |
120
+ |------|------|------|--------|
121
+ | type | 按钮类型 | `primary` / `success` / `warning` / `danger` / `info` / `secondary` | - |
122
+ | size | 按钮尺寸 | `small` / `medium` / `large` | `medium` |
123
+ | disabled | 是否禁用 | boolean | false |
56
124
 
57
125
  ### Card 卡片
58
126
 
@@ -62,7 +130,7 @@ app.mount('#app')
62
130
  <template #header>
63
131
  <Button type="primary" size="small">操作</Button>
64
132
  </template>
65
- <div>卡片内容</div>
133
+ <p>卡片内容区域</p>
66
134
  <template #footer>
67
135
  <Button type="secondary">取消</Button>
68
136
  <Button type="primary">确认</Button>
@@ -71,92 +139,230 @@ app.mount('#app')
71
139
  </template>
72
140
  ```
73
141
 
74
- **Props:**
75
- - `title`: 卡片标题
76
- - `shadow`: 是否显示阴影,默认 `true`
77
-
78
- **Slots:**
79
- - `default`: 卡片内容
80
- - `header`: 卡片头部
81
- - `footer`: 卡片底部
142
+ | 属性 | 说明 | 类型 | 默认值 |
143
+ |------|------|------|--------|
144
+ | title | 卡片标题 | string | - |
145
+ | shadow | 是否显示阴影 | boolean | true |
82
146
 
83
147
  ### Modal 模态框
84
148
 
85
149
  ```vue
86
150
  <template>
87
151
  <Button @click="visible = true">打开模态框</Button>
88
- <Modal :visible="visible" title="标题" @close="visible = false">
89
- <div>模态框内容</div>
152
+
153
+ <Modal
154
+ v-model:visible="visible"
155
+ title="提示"
156
+ @confirm="handleConfirm"
157
+ @cancel="handleCancel"
158
+ >
159
+ <p>这是一段内容...</p>
90
160
  </Modal>
91
161
  </template>
92
162
 
93
163
  <script setup>
94
164
  import { ref } from 'vue'
165
+
95
166
  const visible = ref(false)
167
+
168
+ const handleConfirm = () => {
169
+ console.log('确认')
170
+ visible.value = false
171
+ }
172
+
173
+ const handleCancel = () => {
174
+ visible.value = false
175
+ }
96
176
  </script>
97
177
  ```
98
178
 
99
- **Props:**
100
- - `visible`: 是否显示
101
- - `title`: 标题
102
- - `showFooter`: 是否显示默认底部按钮
179
+ | 属性 | 说明 | 类型 | 默认值 |
180
+ |------|------|------|--------|
181
+ | visible | 是否显示 | boolean | false |
182
+ | title | 标题 | string | - |
183
+ | width | 宽度 | string | '500px' |
184
+ | showFooter | 是否显示底部按钮 | boolean | true |
185
+
186
+ ### Message 消息提示
187
+
188
+ ```javascript
189
+ import { Message } from 'little-dizzy'
190
+
191
+ // 基础用法
192
+ Message.info('这是一条消息')
193
+ Message.success('操作成功')
194
+ Message.warning('警告信息')
195
+ Message.error('错误信息')
196
+
197
+ // 自定义配置
198
+ Message({
199
+ type: 'success',
200
+ content: '自定义消息',
201
+ duration: 5000
202
+ })
203
+ ```
204
+
205
+ ### LzImg 图片
206
+
207
+ ```vue
208
+ <template>
209
+ <!-- 基础用法 -->
210
+ <LzImg
211
+ src="https://example.com/image.jpg"
212
+ width="300"
213
+ height="200"
214
+ />
215
+
216
+ <!-- 开启预览 -->
217
+ <LzImg
218
+ src="https://example.com/image.jpg"
219
+ width="300"
220
+ height="200"
221
+ preview
222
+ />
223
+
224
+ <!-- 多图预览 -->
225
+ <LzImg
226
+ v-for="(src, index) in images"
227
+ :key="index"
228
+ :src="src"
229
+ width="120"
230
+ height="120"
231
+ preview
232
+ :preview-src-list="images"
233
+ />
234
+ </template>
235
+ ```
103
236
 
104
- **Events:**
105
- - `close`: 关闭时触发
106
- - `cancel`: 点击取消按钮
107
- - `confirm`: 点击确认按钮
237
+ | 属性 | 说明 | 类型 | 默认值 |
238
+ |------|------|------|--------|
239
+ | src | 图片地址 | string | - |
240
+ | width | 宽度 | string / number | - |
241
+ | height | 高度 | string / number | - |
242
+ | fit | 填充模式 | `fill` / `contain` / `cover` / `none` / `scale-down` | `cover` |
243
+ | preview | 是否开启预览 | boolean | false |
244
+ | previewSrcList | 预览图片列表 | array | [] |
245
+ | round | 是否圆形 | boolean | false |
246
+ | radius | 圆角大小 | string / number | - |
108
247
 
109
- ## 代码片段系统
248
+ ## 💡 代码片段系统
110
249
 
111
- LittleDizzy 提供了代码片段注册系统,方便展示组件使用示例。
250
+ LittleDizzy 内置代码片段注册系统,方便展示组件使用示例。
112
251
 
113
- ### 注册自定义代码片段
252
+ ### 注册代码片段
114
253
 
115
254
  ```javascript
116
255
  import { registerSnippet } from 'little-dizzy'
117
256
 
118
257
  registerSnippet({
119
- name: 'MyButton',
120
- type: 'html', // 'vue' | 'html' | 'css' | 'javascript'
121
- label: '我的按钮',
122
- code: `<button class="my-btn">Click Me</button>
123
-
124
- <style>
125
- .my-btn {
126
- padding: 10px 20px;
127
- background: #42b883;
258
+ name: 'MyComponent',
259
+ type: 'vue', // 'vue' | 'html' | 'css' | 'javascript'
260
+ label: '我的组件',
261
+ code: `<template>
262
+ <div class="my-component">
263
+ Hello World
264
+ </div>
265
+ </template>
266
+
267
+ <style scoped>
268
+ .my-component {
269
+ padding: 20px;
270
+ background: linear-gradient(135deg, #667eea, #764ba2);
128
271
  color: white;
129
- border: none;
130
- border-radius: 4px;
272
+ border-radius: 8px;
131
273
  }
132
274
  </style>`
133
275
  })
134
276
  ```
135
277
 
136
- ### 获取所有代码片段
278
+ ### 获取代码片段
137
279
 
138
280
  ```javascript
139
- import { snippets } from 'little-dizzy'
281
+ import { snippets, getSnippet } from 'little-dizzy'
140
282
 
283
+ // 获取所有代码片段
141
284
  const allSnippets = snippets()
285
+
286
+ // 获取单个代码片段
287
+ const mySnippet = getSnippet('MyComponent')
142
288
  ```
143
289
 
144
- ## 开发
290
+ ## 🛠 开发指南
145
291
 
146
292
  ```bash
293
+ # 克隆项目
294
+ git clone https://gitee.com/nizuinande/little-dizzy.git
295
+
296
+ # 进入目录
297
+ cd little-dizzy
298
+
147
299
  # 安装依赖
148
300
  npm install
149
301
 
150
302
  # 启动开发服务器
151
303
  npm run dev
152
304
 
153
- # 构建库
305
+ # 构建组件库
154
306
  npm run build:lib
155
307
 
156
308
  # 构建演示站点
157
309
  npm run build
310
+
311
+ # 预览构建结果
312
+ npm run preview
158
313
  ```
159
314
 
160
- ## License
315
+ ## 📁 项目结构
316
+
317
+ ```
318
+ little-dizzy/
319
+ ├── src/
320
+ │ ├── components/ # 组件源码
321
+ │ │ ├── custom/ # 创意组件
322
+ │ │ ├── Button.vue
323
+ │ │ ├── Card.vue
324
+ │ │ ├── Modal.vue
325
+ │ │ └── ...
326
+ │ ├── demo/ # 演示站点
327
+ │ │ ├── views/
328
+ │ │ ├── templates/
329
+ │ │ └── App.vue
330
+ │ ├── snippets/ # 代码片段
331
+ │ ├── styles/ # 样式文件
332
+ │ └── index.js # 入口文件
333
+ ├── dist/ # 构建输出
334
+ ├── package.json
335
+ └── vite.config.js
336
+ ```
337
+
338
+ ## 🤝 贡献指南
339
+
340
+ 欢迎提交 Issue 或 Pull Request!
341
+
342
+ 1. Fork 本仓库
343
+ 2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)
344
+ 3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
345
+ 4. 推送到分支 (`git push origin feature/AmazingFeature`)
346
+ 5. 提交 Pull Request
347
+
348
+ ## 📄 更新日志
349
+
350
+ ### v2.8.0
351
+ - 新增 `LzImg` 图片组件,支持预览和多图切换
352
+ - 优化 Modal 组件动画效果
353
+ - 首页增加动态效果
354
+
355
+ ### v2.7.0
356
+ - 新增上一个/下一个组件导航
357
+ - 优化侧边栏导航结构
358
+ - 新增页面切换动画
359
+
360
+ ## 📜 License
361
+
362
+ [MIT License](./LICENSE) © 2024 LittleDizzy
363
+
364
+ ---
161
365
 
162
- MIT
366
+ <p align="center">
367
+ Made with ❤️ by <a href="https://gitee.com/nizuinande">fsk</a>
368
+ </p>