jianghu-ui 1.0.1
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 +376 -0
- package/dist/jianghu-ui.css +2318 -0
- package/dist/jianghu-ui.js +2 -0
- package/dist/jianghu-ui.js.LICENSE.txt +1 -0
- package/package.json +56 -0
- package/src/Design.stories.mdx +195 -0
- package/src/Introduction.stories.mdx +148 -0
- package/src/components/JhAddressSelect/JhAddressSelect.md +250 -0
- package/src/components/JhAddressSelect/JhAddressSelect.stories.js +282 -0
- package/src/components/JhAddressSelect/JhAddressSelect.vue +261 -0
- package/src/components/JhCard/JhCard.md +246 -0
- package/src/components/JhCard/JhCard.stories.js +688 -0
- package/src/components/JhCard/JhCard.vue +604 -0
- package/src/components/JhCheckCard/JhCheckCard.md +245 -0
- package/src/components/JhCheckCard/JhCheckCard.stories.js +750 -0
- package/src/components/JhCheckCard/JhCheckCard.vue +476 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.md +70 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.stories.js +550 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.vue +181 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.md +56 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.stories.js +320 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.vue +307 -0
- package/src/components/JhDescriptions/JhDescriptions.md +724 -0
- package/src/components/JhDescriptions/JhDescriptions.stories.js +858 -0
- package/src/components/JhDescriptions/JhDescriptions.vue +933 -0
- package/src/components/JhDraggable/JhDraggable.md +66 -0
- package/src/components/JhDraggable/JhDraggable.stories.js +161 -0
- package/src/components/JhDraggable/JhDraggable.vue +254 -0
- package/src/components/JhDrawer/JhDrawer.md +68 -0
- package/src/components/JhDrawer/JhDrawer.stories.js +478 -0
- package/src/components/JhDrawer/JhDrawer.vue +281 -0
- package/src/components/JhDrawerForm/JhDrawerForm.md +69 -0
- package/src/components/JhDrawerForm/JhDrawerForm.stories.js +492 -0
- package/src/components/JhDrawerForm/JhDrawerForm.vue +297 -0
- package/src/components/JhEditableTable/JhEditableTable.md +507 -0
- package/src/components/JhEditableTable/JhEditableTable.stories.js +615 -0
- package/src/components/JhEditableTable/JhEditableTable.vue +685 -0
- package/src/components/JhFileInput/JhFileInput.md +56 -0
- package/src/components/JhFileInput/JhFileInput.stories.js +103 -0
- package/src/components/JhFileInput/JhFileInput.vue +253 -0
- package/src/components/JhForm/JhForm.md +676 -0
- package/src/components/JhForm/JhForm.stories.js +1375 -0
- package/src/components/JhForm/JhForm.vue +657 -0
- package/src/components/JhFormField/JhFormField.stories.js +217 -0
- package/src/components/JhFormField/JhFormField.vue +439 -0
- package/src/components/JhFormFields/JhFormFields.md +647 -0
- package/src/components/JhFormFields/JhFormFields.stories.js +922 -0
- package/src/components/JhFormFields/JhFormFields.vue +998 -0
- package/src/components/JhFormList/JhFormList.md +303 -0
- package/src/components/JhFormList/JhFormList.stories.js +661 -0
- package/src/components/JhFormList/JhFormList.vue +1127 -0
- package/src/components/JhJsonEditor/JhJsonEditor.md +54 -0
- package/src/components/JhJsonEditor/JhJsonEditor.stories.js +157 -0
- package/src/components/JhJsonEditor/JhJsonEditor.vue +178 -0
- package/src/components/JhLayout/JhLayout.md +580 -0
- package/src/components/JhLayout/JhLayout.stories.js +414 -0
- package/src/components/JhLayout/JhLayout.vue +387 -0
- package/src/components/JhList/JhList.md +441 -0
- package/src/components/JhList/JhList.stories.js +524 -0
- package/src/components/JhList/JhList.vue +571 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +56 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.stories.js +191 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.vue +188 -0
- package/src/components/JhMask/JhMask.md +62 -0
- package/src/components/JhMask/JhMask.stories.js +270 -0
- package/src/components/JhMask/JhMask.vue +123 -0
- package/src/components/JhMenu/JhMenu.md +85 -0
- package/src/components/JhMenu/JhMenu.stories.js +384 -0
- package/src/components/JhMenu/JhMenu.vue +545 -0
- package/src/components/JhModal/JhModal.md +68 -0
- package/src/components/JhModal/JhModal.stories.js +562 -0
- package/src/components/JhModal/JhModal.vue +235 -0
- package/src/components/JhModalForm/JhModalForm.md +69 -0
- package/src/components/JhModalForm/JhModalForm.stories.js +592 -0
- package/src/components/JhModalForm/JhModalForm.vue +298 -0
- package/src/components/JhPageContainer/JhPageContainer.md +409 -0
- package/src/components/JhPageContainer/JhPageContainer.stories.js +209 -0
- package/src/components/JhPageContainer/JhPageContainer.vue +72 -0
- package/src/components/JhQueryFilter/JhQueryFilter.md +77 -0
- package/src/components/JhQueryFilter/JhQueryFilter.stories.js +684 -0
- package/src/components/JhQueryFilter/JhQueryFilter.vue +429 -0
- package/src/components/JhScene/JhScene.md +64 -0
- package/src/components/JhScene/JhScene.stories.js +317 -0
- package/src/components/JhScene/JhScene.vue +376 -0
- package/src/components/JhStatisticCard/JhStatisticCard.md +363 -0
- package/src/components/JhStatisticCard/JhStatisticCard.stories.js +847 -0
- package/src/components/JhStatisticCard/JhStatisticCard.vue +459 -0
- package/src/components/JhStepsForm/JhStepsForm.md +666 -0
- package/src/components/JhStepsForm/JhStepsForm.stories.js +1224 -0
- package/src/components/JhStepsForm/JhStepsForm.vue +749 -0
- package/src/components/JhTable/JhTable.md +730 -0
- package/src/components/JhTable/JhTable.stories.js +1444 -0
- package/src/components/JhTable/JhTable.vue +2298 -0
- package/src/components/JhTableAttachment/JhTableAttachment.md +70 -0
- package/src/components/JhTableAttachment/JhTableAttachment.stories.js +198 -0
- package/src/components/JhTableAttachment/JhTableAttachment.vue +264 -0
- package/src/components/JhToast/JhToast.md +67 -0
- package/src/components/JhToast/JhToast.stories.js +386 -0
- package/src/components/JhToast/JhToast.vue +239 -0
- package/src/components/JhTreeSelect/JhTreeSelect.md +82 -0
- package/src/components/JhTreeSelect/JhTreeSelect.stories.js +391 -0
- package/src/components/JhTreeSelect/JhTreeSelect.vue +727 -0
- package/src/components/JhWaterMark/JhWaterMark.md +190 -0
- package/src/components/JhWaterMark/JhWaterMark.stories.js +675 -0
- package/src/components/JhWaterMark/JhWaterMark.vue +351 -0
- package/src/components/README.md +52 -0
- package/src/index.js +135 -0
- package/src/style/globalCSSJHV4.css +348 -0
- package/src/style/globalCSSVuetifyV4.css +637 -0
- package/src/style/storybook.css +4 -0
- package/src/tailwind.css +3 -0
- package/src/utils/vuetify.js +31 -0
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import JhList from './JhList.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: '数据展示/JhList - 高级列表',
|
|
5
|
+
component: JhList,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// 模拟数据
|
|
10
|
+
const mockData = Array.from({ length: 50 }, (_, i) => ({
|
|
11
|
+
id: i + 1,
|
|
12
|
+
title: `列表项标题 ${i + 1}`,
|
|
13
|
+
subTitle: `副标题 ${i + 1}`,
|
|
14
|
+
description: `这是列表项 ${i + 1} 的描述信息,可以包含更多详细内容。`,
|
|
15
|
+
avatar: `https://i.pravatar.cc/150?img=${(i % 70) + 1}`,
|
|
16
|
+
status: ['success', 'processing', 'error', 'warning'][i % 4],
|
|
17
|
+
progress: Math.floor(Math.random() * 100),
|
|
18
|
+
createTime: new Date(Date.now() - Math.random() * 10000000000).toLocaleDateString(),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
// 基础列表
|
|
22
|
+
export const Basic = {
|
|
23
|
+
render: () => ({
|
|
24
|
+
components: { JhList },
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
dataSource: mockData.slice(0, 10),
|
|
28
|
+
metas: {
|
|
29
|
+
title: 'title',
|
|
30
|
+
description: 'description',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
template: `
|
|
35
|
+
<jh-list
|
|
36
|
+
:data-source="dataSource"
|
|
37
|
+
:metas="metas"
|
|
38
|
+
header-title="基础列表"
|
|
39
|
+
/>
|
|
40
|
+
`,
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// 带头像的列表
|
|
45
|
+
export const WithAvatar = {
|
|
46
|
+
render: () => ({
|
|
47
|
+
components: { JhList },
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
dataSource: mockData.slice(0, 10),
|
|
51
|
+
metas: {
|
|
52
|
+
title: 'title',
|
|
53
|
+
subTitle: 'subTitle',
|
|
54
|
+
description: 'description',
|
|
55
|
+
avatar: 'avatar',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
template: `
|
|
60
|
+
<jh-list
|
|
61
|
+
:data-source="dataSource"
|
|
62
|
+
:metas="metas"
|
|
63
|
+
header-title="带头像的列表"
|
|
64
|
+
tooltip="这是一个带头像的列表示例"
|
|
65
|
+
/>
|
|
66
|
+
`,
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// 带操作按钮的列表
|
|
71
|
+
export const WithActions = {
|
|
72
|
+
render: () => ({
|
|
73
|
+
components: { JhList },
|
|
74
|
+
data() {
|
|
75
|
+
return {
|
|
76
|
+
dataSource: mockData.slice(0, 10).map(item => ({
|
|
77
|
+
...item,
|
|
78
|
+
actions: [
|
|
79
|
+
{ text: '编辑', icon: 'mdi-pencil', color: 'primary' },
|
|
80
|
+
{ text: '删除', icon: 'mdi-delete', color: 'error' },
|
|
81
|
+
],
|
|
82
|
+
})),
|
|
83
|
+
metas: {
|
|
84
|
+
title: 'title',
|
|
85
|
+
description: 'description',
|
|
86
|
+
avatar: 'avatar',
|
|
87
|
+
actions: 'actions',
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
methods: {
|
|
92
|
+
handleAction(action, item) {
|
|
93
|
+
alert(`${action.text}: ${item.title}`);
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
template: `
|
|
97
|
+
<jh-list
|
|
98
|
+
:data-source="dataSource"
|
|
99
|
+
:metas="metas"
|
|
100
|
+
header-title="带操作按钮的列表"
|
|
101
|
+
@action-click="handleAction"
|
|
102
|
+
/>
|
|
103
|
+
`,
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// 带额外内容的列表
|
|
108
|
+
export const WithExtra = {
|
|
109
|
+
render: () => ({
|
|
110
|
+
components: { JhList },
|
|
111
|
+
data() {
|
|
112
|
+
return {
|
|
113
|
+
dataSource: mockData.slice(0, 10),
|
|
114
|
+
metas: {
|
|
115
|
+
title: 'title',
|
|
116
|
+
description: 'description',
|
|
117
|
+
avatar: 'avatar',
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
template: `
|
|
122
|
+
<jh-list
|
|
123
|
+
:data-source="dataSource"
|
|
124
|
+
:metas="metas"
|
|
125
|
+
header-title="带额外内容的列表"
|
|
126
|
+
>
|
|
127
|
+
<template #extra="{ item }">
|
|
128
|
+
<div style="text-align: right;">
|
|
129
|
+
<div style="font-size: 20px; font-weight: bold; color: #1890ff;">{{ item.progress }}%</div>
|
|
130
|
+
<div style="font-size: 12px; color: #999;">{{ item.createTime }}</div>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
</jh-list>
|
|
134
|
+
`,
|
|
135
|
+
}),
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// 网格布局
|
|
139
|
+
export const GridLayout = {
|
|
140
|
+
render: () => ({
|
|
141
|
+
components: { JhList },
|
|
142
|
+
data() {
|
|
143
|
+
return {
|
|
144
|
+
dataSource: mockData.slice(0, 12),
|
|
145
|
+
metas: {
|
|
146
|
+
title: 'title',
|
|
147
|
+
description: 'description',
|
|
148
|
+
avatar: 'avatar',
|
|
149
|
+
},
|
|
150
|
+
grid: {
|
|
151
|
+
column: 12,
|
|
152
|
+
xs: 12,
|
|
153
|
+
sm: 6,
|
|
154
|
+
md: 4,
|
|
155
|
+
lg: 3,
|
|
156
|
+
xl: 3,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
template: `
|
|
161
|
+
<jh-list
|
|
162
|
+
:data-source="dataSource"
|
|
163
|
+
:metas="metas"
|
|
164
|
+
:grid="grid"
|
|
165
|
+
layout="grid"
|
|
166
|
+
header-title="网格布局"
|
|
167
|
+
/>
|
|
168
|
+
`,
|
|
169
|
+
}),
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// 可选择列表
|
|
173
|
+
export const WithSelection = {
|
|
174
|
+
render: () => ({
|
|
175
|
+
components: { JhList },
|
|
176
|
+
data() {
|
|
177
|
+
return {
|
|
178
|
+
dataSource: mockData.slice(0, 10),
|
|
179
|
+
metas: {
|
|
180
|
+
title: 'title',
|
|
181
|
+
description: 'description',
|
|
182
|
+
avatar: 'avatar',
|
|
183
|
+
},
|
|
184
|
+
rowSelection: {
|
|
185
|
+
onChange: (keys, rows) => {
|
|
186
|
+
console.log('Selected:', keys, rows);
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
},
|
|
191
|
+
template: `
|
|
192
|
+
<jh-list
|
|
193
|
+
:data-source="dataSource"
|
|
194
|
+
:metas="metas"
|
|
195
|
+
:row-selection="rowSelection"
|
|
196
|
+
header-title="可选择列表"
|
|
197
|
+
>
|
|
198
|
+
<template #alert-actions="{ selectedRows }">
|
|
199
|
+
<v-btn small color="primary">批量操作</v-btn>
|
|
200
|
+
<v-btn small color="error">批量删除</v-btn>
|
|
201
|
+
</template>
|
|
202
|
+
</jh-list>
|
|
203
|
+
`,
|
|
204
|
+
}),
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// 服务端分页
|
|
208
|
+
export const ServerPagination = {
|
|
209
|
+
render: () => ({
|
|
210
|
+
components: { JhList },
|
|
211
|
+
data() {
|
|
212
|
+
return {
|
|
213
|
+
metas: {
|
|
214
|
+
title: 'title',
|
|
215
|
+
description: 'description',
|
|
216
|
+
avatar: 'avatar',
|
|
217
|
+
subTitle: 'subTitle',
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
methods: {
|
|
222
|
+
async request(params) {
|
|
223
|
+
console.log('Request params:', params);
|
|
224
|
+
// 模拟异步请求
|
|
225
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
226
|
+
|
|
227
|
+
const { current, pageSize, search } = params;
|
|
228
|
+
let data = [...mockData];
|
|
229
|
+
|
|
230
|
+
// 搜索过滤
|
|
231
|
+
if (search) {
|
|
232
|
+
data = data.filter(item =>
|
|
233
|
+
item.title.includes(search) ||
|
|
234
|
+
item.description.includes(search)
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const total = data.length;
|
|
239
|
+
const start = (current - 1) * pageSize;
|
|
240
|
+
const end = start + pageSize;
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
success: true,
|
|
244
|
+
data: data.slice(start, end),
|
|
245
|
+
total,
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
template: `
|
|
250
|
+
<jh-list
|
|
251
|
+
:request="request"
|
|
252
|
+
:metas="metas"
|
|
253
|
+
header-title="服务端分页列表"
|
|
254
|
+
tooltip="支持搜索和分页"
|
|
255
|
+
/>
|
|
256
|
+
`,
|
|
257
|
+
}),
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// 自定义渲染
|
|
261
|
+
export const CustomRender = {
|
|
262
|
+
render: () => ({
|
|
263
|
+
components: { JhList },
|
|
264
|
+
data() {
|
|
265
|
+
return {
|
|
266
|
+
dataSource: mockData.slice(0, 10),
|
|
267
|
+
metas: {
|
|
268
|
+
title: 'title',
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
template: `
|
|
273
|
+
<jh-list
|
|
274
|
+
:data-source="dataSource"
|
|
275
|
+
:metas="metas"
|
|
276
|
+
header-title="自定义渲染"
|
|
277
|
+
>
|
|
278
|
+
<template #renderItem="{ item, index }">
|
|
279
|
+
<v-card class="pa-4" elevation="2" style="width: 100%;">
|
|
280
|
+
<div style="display: flex; align-items: center; gap: 16px;">
|
|
281
|
+
<v-avatar size="60" color="primary">
|
|
282
|
+
<span class="white--text text-h6">{{ index + 1 }}</span>
|
|
283
|
+
</v-avatar>
|
|
284
|
+
<div style="flex: 1;">
|
|
285
|
+
<div style="font-size: 18px; font-weight: bold; margin-bottom: 8px;">
|
|
286
|
+
{{ item.title }}
|
|
287
|
+
</div>
|
|
288
|
+
<div style="color: #666; margin-bottom: 8px;">
|
|
289
|
+
{{ item.description }}
|
|
290
|
+
</div>
|
|
291
|
+
<v-chip small :color="item.status === 'success' ? 'success' : 'warning'">
|
|
292
|
+
{{ item.status }}
|
|
293
|
+
</v-chip>
|
|
294
|
+
</div>
|
|
295
|
+
<div style="text-align: right;">
|
|
296
|
+
<v-progress-circular
|
|
297
|
+
:value="item.progress"
|
|
298
|
+
:color="item.progress > 80 ? 'success' : 'primary'"
|
|
299
|
+
size="60"
|
|
300
|
+
width="6"
|
|
301
|
+
>
|
|
302
|
+
{{ item.progress }}%
|
|
303
|
+
</v-progress-circular>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
</v-card>
|
|
307
|
+
</template>
|
|
308
|
+
</jh-list>
|
|
309
|
+
`,
|
|
310
|
+
}),
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
// 不同尺寸
|
|
314
|
+
export const DifferentSizes = {
|
|
315
|
+
render: () => ({
|
|
316
|
+
components: { JhList },
|
|
317
|
+
data() {
|
|
318
|
+
return {
|
|
319
|
+
dataSource: mockData.slice(0, 5),
|
|
320
|
+
metas: {
|
|
321
|
+
title: 'title',
|
|
322
|
+
description: 'description',
|
|
323
|
+
avatar: 'avatar',
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
template: `
|
|
328
|
+
<div>
|
|
329
|
+
<h3>小尺寸</h3>
|
|
330
|
+
<jh-list
|
|
331
|
+
:data-source="dataSource"
|
|
332
|
+
:metas="metas"
|
|
333
|
+
size="small"
|
|
334
|
+
header-title="小尺寸列表"
|
|
335
|
+
/>
|
|
336
|
+
|
|
337
|
+
<h3 class="mt-6">默认尺寸</h3>
|
|
338
|
+
<jh-list
|
|
339
|
+
:data-source="dataSource"
|
|
340
|
+
:metas="metas"
|
|
341
|
+
size="default"
|
|
342
|
+
header-title="默认尺寸列表"
|
|
343
|
+
/>
|
|
344
|
+
|
|
345
|
+
<h3 class="mt-6">大尺寸</h3>
|
|
346
|
+
<jh-list
|
|
347
|
+
:data-source="dataSource"
|
|
348
|
+
:metas="metas"
|
|
349
|
+
size="large"
|
|
350
|
+
header-title="大尺寸列表"
|
|
351
|
+
/>
|
|
352
|
+
</div>
|
|
353
|
+
`,
|
|
354
|
+
}),
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
// 幽灵模式
|
|
358
|
+
export const GhostMode = {
|
|
359
|
+
render: () => ({
|
|
360
|
+
components: { JhList },
|
|
361
|
+
data() {
|
|
362
|
+
return {
|
|
363
|
+
dataSource: mockData.slice(0, 10),
|
|
364
|
+
metas: {
|
|
365
|
+
title: 'title',
|
|
366
|
+
description: 'description',
|
|
367
|
+
avatar: 'avatar',
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
},
|
|
371
|
+
template: `
|
|
372
|
+
<jh-list
|
|
373
|
+
:data-source="dataSource"
|
|
374
|
+
:metas="metas"
|
|
375
|
+
ghost
|
|
376
|
+
header-title="幽灵模式列表"
|
|
377
|
+
tooltip="无边框无背景"
|
|
378
|
+
/>
|
|
379
|
+
`,
|
|
380
|
+
}),
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// 工具栏配置
|
|
384
|
+
export const ToolbarConfig = {
|
|
385
|
+
render: () => ({
|
|
386
|
+
components: { JhList },
|
|
387
|
+
data() {
|
|
388
|
+
return {
|
|
389
|
+
dataSource: mockData.slice(0, 10),
|
|
390
|
+
metas: {
|
|
391
|
+
title: 'title',
|
|
392
|
+
description: 'description',
|
|
393
|
+
avatar: 'avatar',
|
|
394
|
+
},
|
|
395
|
+
toolbar: {
|
|
396
|
+
search: true,
|
|
397
|
+
refresh: true,
|
|
398
|
+
layout: true,
|
|
399
|
+
size: true,
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
},
|
|
403
|
+
template: `
|
|
404
|
+
<jh-list
|
|
405
|
+
:data-source="dataSource"
|
|
406
|
+
:metas="metas"
|
|
407
|
+
:toolbar="toolbar"
|
|
408
|
+
header-title="完整工具栏"
|
|
409
|
+
>
|
|
410
|
+
<template #toolbar-actions>
|
|
411
|
+
<v-btn color="success" small>
|
|
412
|
+
<v-icon left small>mdi-plus</v-icon>
|
|
413
|
+
新增
|
|
414
|
+
</v-btn>
|
|
415
|
+
<v-btn color="primary" small>
|
|
416
|
+
<v-icon left small>mdi-export</v-icon>
|
|
417
|
+
导出
|
|
418
|
+
</v-btn>
|
|
419
|
+
</template>
|
|
420
|
+
<template #toolbar-extra>
|
|
421
|
+
<v-btn icon small>
|
|
422
|
+
<v-icon>mdi-cog</v-icon>
|
|
423
|
+
</v-btn>
|
|
424
|
+
</template>
|
|
425
|
+
</jh-list>
|
|
426
|
+
`,
|
|
427
|
+
}),
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
// 复杂示例
|
|
431
|
+
export const ComplexExample = {
|
|
432
|
+
render: () => ({
|
|
433
|
+
components: { JhList },
|
|
434
|
+
data() {
|
|
435
|
+
return {
|
|
436
|
+
dataSource: mockData.slice(0, 20),
|
|
437
|
+
metas: {
|
|
438
|
+
title: 'title',
|
|
439
|
+
subTitle: 'subTitle',
|
|
440
|
+
description: 'description',
|
|
441
|
+
avatar: 'avatar',
|
|
442
|
+
},
|
|
443
|
+
rowSelection: {
|
|
444
|
+
onChange: (keys, rows) => {
|
|
445
|
+
console.log('Selected:', keys, rows);
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
grid: {
|
|
449
|
+
column: 12,
|
|
450
|
+
xs: 12,
|
|
451
|
+
sm: 6,
|
|
452
|
+
md: 4,
|
|
453
|
+
lg: 3,
|
|
454
|
+
},
|
|
455
|
+
};
|
|
456
|
+
},
|
|
457
|
+
methods: {
|
|
458
|
+
handleRefresh() {
|
|
459
|
+
alert('刷新列表');
|
|
460
|
+
},
|
|
461
|
+
handleBatchDelete() {
|
|
462
|
+
alert('批量删除');
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
template: `
|
|
466
|
+
<jh-list
|
|
467
|
+
:data-source="dataSource"
|
|
468
|
+
:metas="metas"
|
|
469
|
+
:row-selection="rowSelection"
|
|
470
|
+
:grid="grid"
|
|
471
|
+
header-title="项目管理"
|
|
472
|
+
tooltip="管理您的所有项目"
|
|
473
|
+
@refresh="handleRefresh"
|
|
474
|
+
>
|
|
475
|
+
<template #toolbar-actions>
|
|
476
|
+
<v-btn color="success" small>
|
|
477
|
+
<v-icon left small>mdi-plus</v-icon>
|
|
478
|
+
新建项目
|
|
479
|
+
</v-btn>
|
|
480
|
+
</template>
|
|
481
|
+
|
|
482
|
+
<template #toolbar-extra>
|
|
483
|
+
<v-btn icon small>
|
|
484
|
+
<v-icon>mdi-filter</v-icon>
|
|
485
|
+
</v-btn>
|
|
486
|
+
<v-btn icon small>
|
|
487
|
+
<v-icon>mdi-download</v-icon>
|
|
488
|
+
</v-btn>
|
|
489
|
+
</template>
|
|
490
|
+
|
|
491
|
+
<template #alert-actions="{ selectedRows }">
|
|
492
|
+
<v-btn small color="primary">批量编辑</v-btn>
|
|
493
|
+
<v-btn small color="error" @click="handleBatchDelete">批量删除</v-btn>
|
|
494
|
+
</template>
|
|
495
|
+
|
|
496
|
+
<template #extra="{ item }">
|
|
497
|
+
<div style="text-align: right;">
|
|
498
|
+
<v-chip small :color="item.status === 'success' ? 'success' : 'warning'">
|
|
499
|
+
{{ item.status }}
|
|
500
|
+
</v-chip>
|
|
501
|
+
<div style="font-size: 12px; color: #999; margin-top: 4px;">
|
|
502
|
+
{{ item.createTime }}
|
|
503
|
+
</div>
|
|
504
|
+
</div>
|
|
505
|
+
</template>
|
|
506
|
+
|
|
507
|
+
<template #actions="{ item }">
|
|
508
|
+
<v-btn text x-small color="primary">
|
|
509
|
+
<v-icon small left>mdi-eye</v-icon>
|
|
510
|
+
查看
|
|
511
|
+
</v-btn>
|
|
512
|
+
<v-btn text x-small color="success">
|
|
513
|
+
<v-icon small left>mdi-pencil</v-icon>
|
|
514
|
+
编辑
|
|
515
|
+
</v-btn>
|
|
516
|
+
<v-btn text x-small color="error">
|
|
517
|
+
<v-icon small left>mdi-delete</v-icon>
|
|
518
|
+
删除
|
|
519
|
+
</v-btn>
|
|
520
|
+
</template>
|
|
521
|
+
</jh-list>
|
|
522
|
+
`,
|
|
523
|
+
}),
|
|
524
|
+
};
|