vue-color-ui 0.0.56 → 0.0.57
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/docs/README.md +120 -0
- package/docs/components/ChatList.md +171 -0
- package/docs/components/ChatRoom.md +175 -0
- package/docs/components/DrawerModal.md +83 -0
- package/docs/components/GridGroup.md +101 -0
- package/docs/components/Loading.md +164 -0
- package/docs/components/Menu.md +195 -0
- package/docs/components/TAvatar.md +49 -0
- package/docs/components/TAvatarGroup.md +40 -0
- package/docs/components/TButton.md +96 -0
- package/docs/components/TIcon.md +50 -0
- package/docs/components/TImageCard.md +135 -0
- package/docs/components/TInputBar.md +148 -0
- package/docs/components/TNavBar.md +118 -0
- package/docs/components/TNavCard.md +62 -0
- package/docs/components/TNewCard.md +60 -0
- package/docs/components/TProductCard.md +105 -0
- package/docs/components/TProfileCard.md +125 -0
- package/docs/components/TSearchBar.md +73 -0
- package/docs/components/TShareCard.md +88 -0
- package/docs/components/TStatCard.md +117 -0
- package/docs/components/TSteps.md +93 -0
- package/docs/components/TTab.md +66 -0
- package/docs/components/TTabs.md +126 -0
- package/docs/components/TTag.md +88 -0
- package/docs/components/TTitle.md +75 -0
- package/docs/components/TTopBar.md +105 -0
- package/docs/components/TVirtualScrollSlide.md +145 -0
- package/docs/components/TimeLine.md +155 -0
- package/docs/guides/colors.md +117 -0
- package/package.json +3 -2
package/docs/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# vue-color-ui 文档
|
|
2
|
+
|
|
3
|
+
欢迎使用 `vue-color-ui` 组件库文档。这里包含了所有组件的详细使用说明。
|
|
4
|
+
|
|
5
|
+
## 📚 文档导航
|
|
6
|
+
|
|
7
|
+
### 快速开始
|
|
8
|
+
|
|
9
|
+
- [安装指南](#安装)
|
|
10
|
+
- [Nuxt 3 快速开始](#nuxt-3-快速开始)
|
|
11
|
+
- [基本使用](#基本使用)
|
|
12
|
+
|
|
13
|
+
### 指南
|
|
14
|
+
|
|
15
|
+
- [颜色系统](./guides/colors.md) - 了解颜色和渐变的使用
|
|
16
|
+
|
|
17
|
+
### 组件文档
|
|
18
|
+
|
|
19
|
+
#### 基础组件
|
|
20
|
+
|
|
21
|
+
- [TIcon](./components/TIcon.md) - 图标组件
|
|
22
|
+
- [TTitle](./components/TTitle.md) - 标题组件
|
|
23
|
+
- [TAvatar](./components/TAvatar.md) - 头像组件
|
|
24
|
+
- [TAvatarGroup](./components/TAvatarGroup.md) - 头像组组件
|
|
25
|
+
- [TButton](./components/TButton.md) - 按钮组件
|
|
26
|
+
- [TTag](./components/TTag.md) - 标签组件
|
|
27
|
+
|
|
28
|
+
#### 导航组件
|
|
29
|
+
|
|
30
|
+
- [TNavBar](./components/TNavBar.md) - 导航栏组件
|
|
31
|
+
- [TTopBar](./components/TTopBar.md) - 顶部操作条
|
|
32
|
+
- [TTabs](./components/TTabs.md) - 标签页组件
|
|
33
|
+
- [TTab](./components/TTab.md) - 标签页子组件
|
|
34
|
+
|
|
35
|
+
#### 卡片组件
|
|
36
|
+
|
|
37
|
+
- [TNavCard](./components/TNavCard.md) - 导航卡片
|
|
38
|
+
- [TNewCard](./components/TNewCard.md) - 新闻卡片
|
|
39
|
+
- [TShareCard](./components/TShareCard.md) - 分享卡片
|
|
40
|
+
- [TImageCard](./components/TImageCard.md) - 图片卡片
|
|
41
|
+
- [TProductCard](./components/TProductCard.md) - 商品卡片
|
|
42
|
+
- [TProfileCard](./components/TProfileCard.md) - 个人资料卡片
|
|
43
|
+
- [TStatCard](./components/TStatCard.md) - 统计卡片
|
|
44
|
+
|
|
45
|
+
#### 表单组件
|
|
46
|
+
|
|
47
|
+
- [TSearchBar](./components/TSearchBar.md) - 搜索栏
|
|
48
|
+
- [TInputBar](./components/TInputBar.md) - 输入栏
|
|
49
|
+
|
|
50
|
+
#### 聊天组件
|
|
51
|
+
|
|
52
|
+
- [ChatList](./components/ChatList.md) - 聊天列表
|
|
53
|
+
- [ChatRoom](./components/ChatRoom.md) - 聊天室
|
|
54
|
+
|
|
55
|
+
#### 布局组件
|
|
56
|
+
|
|
57
|
+
- [GridGroup](./components/GridGroup.md) - 网格组
|
|
58
|
+
- [Menu](./components/Menu.md) - 菜单组件
|
|
59
|
+
|
|
60
|
+
#### 高级组件
|
|
61
|
+
|
|
62
|
+
- [TVirtualScrollSlide](./components/TVirtualScrollSlide.md) - 虚拟滚动滑动组件
|
|
63
|
+
- [TimeLine](./components/TimeLine.md) - 时间轴组件
|
|
64
|
+
- [TSteps](./components/TSteps.md) - 步骤条组件
|
|
65
|
+
- [DrawerModal](./components/DrawerModal.md) - 抽屉模态框
|
|
66
|
+
- [Loading](./components/Loading.md) - 加载动画组件
|
|
67
|
+
|
|
68
|
+
## 安装
|
|
69
|
+
|
|
70
|
+
使用 npm 安装 `vue-color-ui`:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install vue-color-ui
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Nuxt 3 快速开始
|
|
77
|
+
|
|
78
|
+
在 Nuxt 3 项目中快速配置 `vue-color-ui`:
|
|
79
|
+
|
|
80
|
+
1. 创建插件文件 `plugins/vue-color-ui.ts`:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import TempColorUI from "vue-color-ui";
|
|
84
|
+
import "vue-color-ui/lib/style.css";
|
|
85
|
+
import "vue-color-ui/lib/css/main.css";
|
|
86
|
+
import "vue-color-ui/lib/css/animation.css";
|
|
87
|
+
import "vue-color-ui/lib/css/icon.css";
|
|
88
|
+
|
|
89
|
+
export default defineNuxtPlugin((app) => {
|
|
90
|
+
app.vueApp.use(TempColorUI);
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 基本使用
|
|
95
|
+
|
|
96
|
+
在你的 Vue 组件中,你可以直接使用 `vue-color-ui` 提供的组件。例如:
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<template>
|
|
100
|
+
<TNavBar :items="navItems" />
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<script setup>
|
|
104
|
+
const navItems = [
|
|
105
|
+
{ icon: "homefill", label: "首页" },
|
|
106
|
+
{ icon: "similar", label: "分类" },
|
|
107
|
+
{ img: "https://ossweb-img.qq.com/images/lol/img/champion/Morgana.png", label: "积分" },
|
|
108
|
+
{ icon: "cart", label: "购物车", badge: 99 },
|
|
109
|
+
{ icon: "my", label: "我的" }
|
|
110
|
+
];
|
|
111
|
+
</script>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 贡献
|
|
115
|
+
|
|
116
|
+
这个项目是一个临时解决方案,等原作者更新了之后再决定是否继续维护。如果你有任何建议或发现任何问题,欢迎提交 issue 或 pull request。
|
|
117
|
+
|
|
118
|
+
## 许可证
|
|
119
|
+
|
|
120
|
+
[MIT](../LICENSE)
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# ChatList 组件
|
|
2
|
+
|
|
3
|
+
`ChatList` 组件用于展示一个聊天列表,其中每一项都是一个 `ChatListItem`。该组件支持显示用户信息、未读消息数、消息内容等,并允许自定义头像、标签和各种状态。
|
|
4
|
+
|
|
5
|
+
## 属性
|
|
6
|
+
|
|
7
|
+
### ChatList属性
|
|
8
|
+
|
|
9
|
+
| 属性名 | 类型 | 默认值 | 描述 |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| `items` | `ChatListItemOption[]` | `[]` | 聊天列表项的数组,每个项包含用户信息、时间、未读消息数等 |
|
|
12
|
+
|
|
13
|
+
### ChatListItemOption属性
|
|
14
|
+
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 描述 |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `userinfo` | `object` | `{}` | 用户信息对象,包含头像、名称、标签等 |
|
|
18
|
+
| `userinfo.avatar` | `string` | `''` | 用户头像的URL |
|
|
19
|
+
| `userinfo.avatarShape` | `string` | `'circle'` | 头像形状,可选值:`'circle'`、`'square'` |
|
|
20
|
+
| `userinfo.name` | `string` | `''` | 用户名称 |
|
|
21
|
+
| `userinfo.tag` | `string` | `''` | 用户标签 |
|
|
22
|
+
| `userinfo.tagColor` | `string` | `'grey'` | 标签颜色 |
|
|
23
|
+
| `time` | `string` | `''` | 消息时间 |
|
|
24
|
+
| `roomId` | `string` | `''` | 聊天室ID |
|
|
25
|
+
| `roomName` | `string` | `''` | 聊天室名称 |
|
|
26
|
+
| `avatarName` | `string` | `'friendfill'` | 默认头像图标名称 |
|
|
27
|
+
| `avatarBg` | `string` | `'grey'` | 头像背景颜色 |
|
|
28
|
+
| `unread` | `string\|number` | `''` | 未读消息数 |
|
|
29
|
+
| `unreadColor` | `string` | `'red'` | 未读消息数标签颜色 |
|
|
30
|
+
| `badge` | `string` | `''` | 徽章内容 |
|
|
31
|
+
| `icon` | `string` | `''` | 图标名称 |
|
|
32
|
+
| `iconClass` | `string` | `''` | 图标样式类名 |
|
|
33
|
+
| `isDisconnected` | `boolean` | `false` | 是否断开连接 |
|
|
34
|
+
| `isCurrent` | `boolean` | `false` | 是否当前选中项 |
|
|
35
|
+
| `content` | `string` | `''` | 消息内容 |
|
|
36
|
+
| `event` | `Function` | `() => {}` | 点击事件回调函数 |
|
|
37
|
+
|
|
38
|
+
## 示例
|
|
39
|
+
|
|
40
|
+
### 示例 1: 基本使用
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<template>
|
|
44
|
+
<ChatList :items="chatItems" />
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup>
|
|
48
|
+
const chatItems = [
|
|
49
|
+
{
|
|
50
|
+
userinfo: {
|
|
51
|
+
avatar: "https://example.com/avatar1.jpg",
|
|
52
|
+
name: "用户1",
|
|
53
|
+
tag: "VIP",
|
|
54
|
+
tagColor: "red"
|
|
55
|
+
},
|
|
56
|
+
time: "10:30 AM",
|
|
57
|
+
unread: 2,
|
|
58
|
+
content: "Hello, how are you?",
|
|
59
|
+
event: (item) => console.log('Clicked on:', item)
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
userinfo: {
|
|
63
|
+
avatar: "https://example.com/avatar2.jpg",
|
|
64
|
+
name: "用户2"
|
|
65
|
+
},
|
|
66
|
+
isDisconnected: true,
|
|
67
|
+
content: "Disconnected"
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
</script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 示例 2: 自定义头像和标签
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<template>
|
|
77
|
+
<ChatList :items="customChatItems" />
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<script setup>
|
|
81
|
+
const customChatItems = [
|
|
82
|
+
{
|
|
83
|
+
userinfo: {
|
|
84
|
+
avatar: "https://example.com/avatar3.jpg",
|
|
85
|
+
avatarShape: "square",
|
|
86
|
+
name: "用户3",
|
|
87
|
+
tag: "New",
|
|
88
|
+
tagColor: "blue"
|
|
89
|
+
},
|
|
90
|
+
time: "Yesterday",
|
|
91
|
+
unread: 5,
|
|
92
|
+
unreadColor: "green",
|
|
93
|
+
content: "New message received"
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
</script>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 示例 3: 带徽章和图标的聊天项
|
|
100
|
+
|
|
101
|
+
```vue
|
|
102
|
+
<template>
|
|
103
|
+
<ChatList :items="badgeChatItems" />
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<script setup>
|
|
107
|
+
const badgeChatItems = [
|
|
108
|
+
{
|
|
109
|
+
userinfo: {
|
|
110
|
+
avatar: "https://example.com/avatar4.jpg",
|
|
111
|
+
name: "用户4"
|
|
112
|
+
},
|
|
113
|
+
badge: "Admin",
|
|
114
|
+
icon: "settings",
|
|
115
|
+
iconClass: "custom-icon-class",
|
|
116
|
+
content: "System settings updated"
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
</script>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 示例 4: 使用回调函数处理点击事件
|
|
123
|
+
|
|
124
|
+
```vue
|
|
125
|
+
<template>
|
|
126
|
+
<ChatList :items="clickableChatItems" />
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<script setup>
|
|
130
|
+
const clickableChatItems = [
|
|
131
|
+
{
|
|
132
|
+
userinfo: {
|
|
133
|
+
avatar: "https://example.com/avatar5.jpg",
|
|
134
|
+
name: "用户5"
|
|
135
|
+
},
|
|
136
|
+
content: "Click me!",
|
|
137
|
+
event: (item) => alert('Clicked on: ' + item.userinfo.name)
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
</script>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## 属性类型定义
|
|
144
|
+
|
|
145
|
+
### `ChatListItemOption`
|
|
146
|
+
|
|
147
|
+
`ChatListItemOption` 是一个对象类型,包含以下属性:
|
|
148
|
+
|
|
149
|
+
| 属性名 | 类型 | 描述 |
|
|
150
|
+
| --- | --- | --- |
|
|
151
|
+
| `userinfo` | `object` | 用户信息对象,包含头像、名称、标签等 |
|
|
152
|
+
| `userinfo.avatar` | `string` | 用户头像的URL |
|
|
153
|
+
| `userinfo.avatarShape` | `string` | 头像形状,可选值:`'circle'`、`'square'` |
|
|
154
|
+
| `userinfo.name` | `string` | 用户名称 |
|
|
155
|
+
| `userinfo.tag` | `string` | 用户标签 |
|
|
156
|
+
| `userinfo.tagColor` | `string` | 标签颜色 |
|
|
157
|
+
| `time` | `string` | 消息时间 |
|
|
158
|
+
| `roomId` | `string` | 聊天室ID |
|
|
159
|
+
| `roomName` | `string` | 聊天室名称 |
|
|
160
|
+
| `avatarName` | `string` | 默认头像图标名称 |
|
|
161
|
+
| `avatarBg` | `string` | 头像背景颜色 |
|
|
162
|
+
| `unread` | `string\|number` | 未读消息数 |
|
|
163
|
+
| `unreadColor` | `string` | 未读消息数标签颜色 |
|
|
164
|
+
| `badge` | `string` | 徽章内容 |
|
|
165
|
+
| `icon` | `string` | 图标名称 |
|
|
166
|
+
| `iconClass` | `string` | 图标样式类名 |
|
|
167
|
+
| `isDisconnected` | `boolean` | 是否断开连接 |
|
|
168
|
+
| `isCurrent` | `boolean` | 是否当前选中项 |
|
|
169
|
+
| `content` | `string` | 消息内容 |
|
|
170
|
+
| `event` | `Function` | 点击事件回调函数 |
|
|
171
|
+
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# ChatRoom 组件
|
|
2
|
+
|
|
3
|
+
`ChatRoom` 是一个聊天室组件,用于展示聊天消息列表,支持多种消息类型。
|
|
4
|
+
|
|
5
|
+
## 属性
|
|
6
|
+
|
|
7
|
+
| 属性名 | 类型 | 默认值 | 描述 |
|
|
8
|
+
| ---------- | --------------- | ------ | ---------- |
|
|
9
|
+
| `messages` | `ChatMessage[]` | `[]` | 消息数组 |
|
|
10
|
+
|
|
11
|
+
### ChatMessage 类型
|
|
12
|
+
|
|
13
|
+
| 属性名 | 类型 | 描述 |
|
|
14
|
+
| --------- | ------------------------------------------------------------ | -------------- |
|
|
15
|
+
| `id` | `number` | 消息ID(必填) |
|
|
16
|
+
| `type` | `"text" \| "image" \| "audio" \| "location" \| "info" \| "markdown" \| "card" \| "link" \| string` | 消息类型 |
|
|
17
|
+
| `content` | `string` | 消息内容 |
|
|
18
|
+
| `date` | `string` | 消息时间 |
|
|
19
|
+
| `self` | `boolean` | 是否自己发送 |
|
|
20
|
+
| `avatar` | `string` | 头像URL |
|
|
21
|
+
| `url` | `string` | 链接URL(link/card类型) |
|
|
22
|
+
| `title` | `string` | 标题(link/card类型) |
|
|
23
|
+
| `emoji` | `string` | 表情(link/card类型) |
|
|
24
|
+
| `icon` | `string` | 图标名称(link/card类型) |
|
|
25
|
+
| `iconColor` | `string` | 图标颜色(link/card类型) |
|
|
26
|
+
|
|
27
|
+
## 插槽
|
|
28
|
+
|
|
29
|
+
| 插槽名 | 参数 | 描述 |
|
|
30
|
+
| ---------------- | ----------------- | -------------- |
|
|
31
|
+
| `custom-message` | `{ message }` | 自定义消息类型 |
|
|
32
|
+
|
|
33
|
+
## 消息类型
|
|
34
|
+
|
|
35
|
+
### text - 文本消息
|
|
36
|
+
普通文本消息
|
|
37
|
+
|
|
38
|
+
### image - 图片消息
|
|
39
|
+
图片消息(当前版本暂未实现显示)
|
|
40
|
+
|
|
41
|
+
### audio - 音频消息
|
|
42
|
+
音频消息,显示音频时长
|
|
43
|
+
|
|
44
|
+
### location - 位置消息
|
|
45
|
+
位置消息,显示位置信息
|
|
46
|
+
|
|
47
|
+
### info - 信息消息
|
|
48
|
+
系统信息消息,如"对方撤回一条消息"
|
|
49
|
+
|
|
50
|
+
### warning - 警告消息
|
|
51
|
+
警告类型的消息
|
|
52
|
+
|
|
53
|
+
### markdown - Markdown消息
|
|
54
|
+
Markdown格式的消息(需自定义渲染)
|
|
55
|
+
|
|
56
|
+
### card - 卡片消息
|
|
57
|
+
卡片类型的消息,包含标题、描述、链接等
|
|
58
|
+
|
|
59
|
+
### link - 链接消息
|
|
60
|
+
链接类型的消息,显示链接预览
|
|
61
|
+
|
|
62
|
+
## 示例
|
|
63
|
+
|
|
64
|
+
### 基本使用
|
|
65
|
+
|
|
66
|
+
```vue
|
|
67
|
+
<template>
|
|
68
|
+
<ChatRoom :messages="messages" />
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script setup>
|
|
72
|
+
const messages = [
|
|
73
|
+
{
|
|
74
|
+
id: 1,
|
|
75
|
+
type: "text",
|
|
76
|
+
content: "你好!",
|
|
77
|
+
date: "10:30",
|
|
78
|
+
self: true,
|
|
79
|
+
avatar: "https://example.com/avatar1.jpg"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 2,
|
|
83
|
+
type: "text",
|
|
84
|
+
content: "你好,有什么可以帮助你的吗?",
|
|
85
|
+
date: "10:31",
|
|
86
|
+
self: false,
|
|
87
|
+
avatar: "https://example.com/avatar2.jpg"
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
</script>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 多种消息类型
|
|
94
|
+
|
|
95
|
+
```vue
|
|
96
|
+
<template>
|
|
97
|
+
<ChatRoom :messages="messages" />
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<script setup>
|
|
101
|
+
const messages = [
|
|
102
|
+
{
|
|
103
|
+
id: 1,
|
|
104
|
+
type: "text",
|
|
105
|
+
content: "这是一条文本消息",
|
|
106
|
+
date: "10:30",
|
|
107
|
+
self: true,
|
|
108
|
+
avatar: "https://example.com/avatar1.jpg"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 2,
|
|
112
|
+
type: "audio",
|
|
113
|
+
content: '3"',
|
|
114
|
+
date: "10:31",
|
|
115
|
+
self: true,
|
|
116
|
+
avatar: "https://example.com/avatar1.jpg"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 3,
|
|
120
|
+
type: "location",
|
|
121
|
+
content: "北京市朝阳区",
|
|
122
|
+
date: "10:32",
|
|
123
|
+
self: true,
|
|
124
|
+
avatar: "https://example.com/avatar1.jpg"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: 4,
|
|
128
|
+
type: "info",
|
|
129
|
+
content: "对方撤回一条消息",
|
|
130
|
+
date: "",
|
|
131
|
+
self: false,
|
|
132
|
+
avatar: ""
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: 5,
|
|
136
|
+
type: "link",
|
|
137
|
+
content: "链接消息内容",
|
|
138
|
+
date: "10:35",
|
|
139
|
+
self: false,
|
|
140
|
+
avatar: "https://example.com/avatar2.jpg",
|
|
141
|
+
url: "https://example.com/article",
|
|
142
|
+
title: "文章标题",
|
|
143
|
+
emoji: "📊"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: 6,
|
|
147
|
+
type: "card",
|
|
148
|
+
content: "卡片消息描述",
|
|
149
|
+
date: "10:36",
|
|
150
|
+
self: true,
|
|
151
|
+
avatar: "https://example.com/avatar1.jpg",
|
|
152
|
+
title: "卡片标题",
|
|
153
|
+
url: "https://example.com/details"
|
|
154
|
+
}
|
|
155
|
+
];
|
|
156
|
+
</script>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 自定义消息类型
|
|
160
|
+
|
|
161
|
+
```vue
|
|
162
|
+
<template>
|
|
163
|
+
<ChatRoom :messages="messages">
|
|
164
|
+
<template #custom-message="{ message }">
|
|
165
|
+
<div v-if="message.type === 'markdown'" class="markdown-message">
|
|
166
|
+
<div v-html="message.content"></div>
|
|
167
|
+
</div>
|
|
168
|
+
<div v-else-if="message.type === 'custom-type'" class="custom-message">
|
|
169
|
+
{{ message.customContent }}
|
|
170
|
+
</div>
|
|
171
|
+
</template>
|
|
172
|
+
</ChatRoom>
|
|
173
|
+
</template>
|
|
174
|
+
```
|
|
175
|
+
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# DrawerModal 组件
|
|
2
|
+
|
|
3
|
+
`DrawerModal` 是一个抽屉模态框组件,用于显示弹窗内容。
|
|
4
|
+
|
|
5
|
+
## 属性
|
|
6
|
+
|
|
7
|
+
| 属性名 | 类型 | 默认值 | 描述 |
|
|
8
|
+
| ------------ | --------- | ------ | ------------------------ |
|
|
9
|
+
| `title` | `string` | - | 模态框标题(必填) |
|
|
10
|
+
| `modelValue` | `boolean` | - | 显示/隐藏状态(v-model) |
|
|
11
|
+
|
|
12
|
+
## 事件
|
|
13
|
+
|
|
14
|
+
| 事件名 | 参数 | 描述 |
|
|
15
|
+
| ------------------ | ----------------- | -------------- |
|
|
16
|
+
| `update:modelValue` | `(value: boolean)` | 状态变化时触发 |
|
|
17
|
+
|
|
18
|
+
## 插槽
|
|
19
|
+
|
|
20
|
+
| 插槽名 | 描述 |
|
|
21
|
+
| ------ | -------------- |
|
|
22
|
+
| 默认 | 模态框内容 |
|
|
23
|
+
|
|
24
|
+
## 示例
|
|
25
|
+
|
|
26
|
+
### 基本使用
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<template>
|
|
30
|
+
<button @click="showModal = true">打开模态框</button>
|
|
31
|
+
<DrawerModal title="标题" v-model="showModal">
|
|
32
|
+
<p>这是模态框的内容</p>
|
|
33
|
+
</DrawerModal>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup>
|
|
37
|
+
import { ref } from 'vue';
|
|
38
|
+
|
|
39
|
+
const showModal = ref(false);
|
|
40
|
+
</script>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 自定义内容
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<template>
|
|
47
|
+
<button @click="showModal = true">打开模态框</button>
|
|
48
|
+
<DrawerModal title="详细信息" v-model="showModal">
|
|
49
|
+
<div class="modal-content">
|
|
50
|
+
<h3>标题</h3>
|
|
51
|
+
<p>详细内容...</p>
|
|
52
|
+
<button @click="showModal = false">关闭</button>
|
|
53
|
+
</div>
|
|
54
|
+
</DrawerModal>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script setup>
|
|
58
|
+
import { ref } from 'vue';
|
|
59
|
+
|
|
60
|
+
const showModal = ref(false);
|
|
61
|
+
</script>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 在模态框中使用其他组件
|
|
65
|
+
|
|
66
|
+
```vue
|
|
67
|
+
<template>
|
|
68
|
+
<button @click="showModal = true">打开聊天列表</button>
|
|
69
|
+
<DrawerModal title="聊天列表" v-model="showModal">
|
|
70
|
+
<ChatList :items="chatItems" />
|
|
71
|
+
</DrawerModal>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script setup>
|
|
75
|
+
import { ref } from 'vue';
|
|
76
|
+
|
|
77
|
+
const showModal = ref(false);
|
|
78
|
+
const chatItems = ref([
|
|
79
|
+
// ... 聊天项数据
|
|
80
|
+
]);
|
|
81
|
+
</script>
|
|
82
|
+
```
|
|
83
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# GridGroup 组件
|
|
2
|
+
|
|
3
|
+
`GridGroup` 是一个网格组组件,用于展示图标网格列表。
|
|
4
|
+
|
|
5
|
+
## 属性
|
|
6
|
+
|
|
7
|
+
| 属性名 | 类型 | 默认值 | 描述 |
|
|
8
|
+
| ------------- | --------------- | ------ | ------------------------ |
|
|
9
|
+
| `cuIconList` | `GridGroupItem[]` | - | 图标项数组 |
|
|
10
|
+
| `gridCol` | `number` | `4` | 网格列数 |
|
|
11
|
+
| `gridBorder` | `boolean` | `false` | 是否显示边框 |
|
|
12
|
+
| `routeFn` | `Function` | - | 自定义路由函数 |
|
|
13
|
+
|
|
14
|
+
### GridGroupItem 类型
|
|
15
|
+
|
|
16
|
+
| 属性名 | 类型 | 描述 |
|
|
17
|
+
| -------- | -------- | ---------- |
|
|
18
|
+
| `cuIcon` | `string` | 图标名称 |
|
|
19
|
+
| `color` | `string` | 图标颜色 |
|
|
20
|
+
| `badge` | `number` | 徽标数字 |
|
|
21
|
+
| `name` | `string` | 显示名称 |
|
|
22
|
+
| `path` | `string` | 路由路径 |
|
|
23
|
+
| `link` | `string` | 外部链接 |
|
|
24
|
+
|
|
25
|
+
## 示例
|
|
26
|
+
|
|
27
|
+
### 基本使用
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<template>
|
|
31
|
+
<GridGroup :cuIconList="iconList" />
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup>
|
|
35
|
+
const iconList = [
|
|
36
|
+
{
|
|
37
|
+
cuIcon: "cardboardfill",
|
|
38
|
+
color: "red",
|
|
39
|
+
badge: 120,
|
|
40
|
+
name: "VR",
|
|
41
|
+
link: "http://www.example.com/"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
cuIcon: "recordfill",
|
|
45
|
+
color: "orange",
|
|
46
|
+
badge: 1,
|
|
47
|
+
name: "录像"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
cuIcon: "picfill",
|
|
51
|
+
color: "yellow",
|
|
52
|
+
badge: 0,
|
|
53
|
+
name: "图像"
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
</script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 自定义列数
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<template>
|
|
63
|
+
<GridGroup :cuIconList="iconList" :gridCol="3" />
|
|
64
|
+
</template>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 显示边框
|
|
68
|
+
|
|
69
|
+
```vue
|
|
70
|
+
<template>
|
|
71
|
+
<GridGroup :cuIconList="iconList" :gridBorder="true" />
|
|
72
|
+
</template>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 路由跳转
|
|
76
|
+
|
|
77
|
+
```vue
|
|
78
|
+
<template>
|
|
79
|
+
<GridGroup :cuIconList="iconList" />
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script setup>
|
|
83
|
+
const iconList = [
|
|
84
|
+
{
|
|
85
|
+
cuIcon: "homefill",
|
|
86
|
+
color: "blue",
|
|
87
|
+
badge: 0,
|
|
88
|
+
name: "首页",
|
|
89
|
+
path: "/home"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
cuIcon: "cart",
|
|
93
|
+
color: "red",
|
|
94
|
+
badge: 5,
|
|
95
|
+
name: "购物车",
|
|
96
|
+
path: "/cart"
|
|
97
|
+
}
|
|
98
|
+
];
|
|
99
|
+
</script>
|
|
100
|
+
```
|
|
101
|
+
|