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,750 @@
|
|
|
1
|
+
import JhCheckCard from './JhCheckCard.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: '数据录入/JhCheckCard - 多选卡片',
|
|
5
|
+
component: JhCheckCard,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: '多选卡片组件,参考 Ant Design ProComponents CheckCard 设计规范。支持单选、多选、不同尺寸、自定义内容等功能。',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
title: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: '卡片标题',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'string' },
|
|
20
|
+
defaultValue: { summary: '' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
description: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: '卡片描述',
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: 'string' },
|
|
28
|
+
defaultValue: { summary: '' },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
cover: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
description: '卡片封面图片URL',
|
|
34
|
+
table: {
|
|
35
|
+
type: { summary: 'string' },
|
|
36
|
+
defaultValue: { summary: '' },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
extra: {
|
|
40
|
+
control: 'text',
|
|
41
|
+
description: '右下角额外内容',
|
|
42
|
+
table: {
|
|
43
|
+
type: { summary: 'string' },
|
|
44
|
+
defaultValue: { summary: '' },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
value: {
|
|
48
|
+
control: 'text',
|
|
49
|
+
description: '卡片值,用于多选时的标识',
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: 'string | number | boolean' },
|
|
52
|
+
defaultValue: { summary: 'null' },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
checked: {
|
|
56
|
+
control: 'boolean',
|
|
57
|
+
description: '是否选中',
|
|
58
|
+
table: {
|
|
59
|
+
type: { summary: 'boolean' },
|
|
60
|
+
defaultValue: { summary: 'false' },
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
defaultChecked: {
|
|
64
|
+
control: 'boolean',
|
|
65
|
+
description: '默认选中状态',
|
|
66
|
+
table: {
|
|
67
|
+
type: { summary: 'boolean' },
|
|
68
|
+
defaultValue: { summary: 'false' },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
disabled: {
|
|
72
|
+
control: 'boolean',
|
|
73
|
+
description: '是否禁用',
|
|
74
|
+
table: {
|
|
75
|
+
type: { summary: 'boolean' },
|
|
76
|
+
defaultValue: { summary: 'false' },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
loading: {
|
|
80
|
+
control: 'boolean',
|
|
81
|
+
description: '是否加载中',
|
|
82
|
+
table: {
|
|
83
|
+
type: { summary: 'boolean' },
|
|
84
|
+
defaultValue: { summary: 'false' },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
size: {
|
|
88
|
+
control: { type: 'select' },
|
|
89
|
+
options: ['small', 'default', 'large'],
|
|
90
|
+
description: '卡片尺寸',
|
|
91
|
+
table: {
|
|
92
|
+
type: { summary: 'string' },
|
|
93
|
+
defaultValue: { summary: 'default' },
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
bordered: {
|
|
97
|
+
control: 'boolean',
|
|
98
|
+
description: '是否显示边框',
|
|
99
|
+
table: {
|
|
100
|
+
type: { summary: 'boolean' },
|
|
101
|
+
defaultValue: { summary: 'true' },
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
hideCheckbox: {
|
|
105
|
+
control: 'boolean',
|
|
106
|
+
description: '是否隐藏选择框',
|
|
107
|
+
table: {
|
|
108
|
+
type: { summary: 'boolean' },
|
|
109
|
+
defaultValue: { summary: 'false' },
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
checkboxPosition: {
|
|
113
|
+
control: { type: 'select' },
|
|
114
|
+
options: ['top-left', 'top-right', 'bottom-left', 'bottom-right'],
|
|
115
|
+
description: '选择框位置',
|
|
116
|
+
table: {
|
|
117
|
+
type: { summary: 'string' },
|
|
118
|
+
defaultValue: { summary: 'top-right' },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
hoverable: {
|
|
122
|
+
control: 'boolean',
|
|
123
|
+
description: '是否可悬浮',
|
|
124
|
+
table: {
|
|
125
|
+
type: { summary: 'boolean' },
|
|
126
|
+
defaultValue: { summary: 'true' },
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
width: {
|
|
130
|
+
control: 'text',
|
|
131
|
+
description: '卡片宽度',
|
|
132
|
+
table: {
|
|
133
|
+
type: { summary: 'string | number' },
|
|
134
|
+
defaultValue: { summary: '' },
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
height: {
|
|
138
|
+
control: 'text',
|
|
139
|
+
description: '卡片高度',
|
|
140
|
+
table: {
|
|
141
|
+
type: { summary: 'string | number' },
|
|
142
|
+
defaultValue: { summary: '' },
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// 基础用法
|
|
149
|
+
export const Basic = {
|
|
150
|
+
render: (args) => ({
|
|
151
|
+
components: { JhCheckCard },
|
|
152
|
+
setup() {
|
|
153
|
+
return { args };
|
|
154
|
+
},
|
|
155
|
+
template: `
|
|
156
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
157
|
+
<jh-check-card
|
|
158
|
+
v-bind="args"
|
|
159
|
+
title="基础卡片"
|
|
160
|
+
description="这是一个基础的多选卡片"
|
|
161
|
+
style="width: 200px;"
|
|
162
|
+
>
|
|
163
|
+
<div>卡片内容</div>
|
|
164
|
+
</jh-check-card>
|
|
165
|
+
</div>
|
|
166
|
+
`,
|
|
167
|
+
}),
|
|
168
|
+
parameters: {
|
|
169
|
+
docs: {
|
|
170
|
+
description: {
|
|
171
|
+
story: '基础的多选卡片,包含标题、描述和内容。',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// 不同尺寸
|
|
178
|
+
export const Sizes = {
|
|
179
|
+
render: () => ({
|
|
180
|
+
components: { JhCheckCard },
|
|
181
|
+
template: `
|
|
182
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
183
|
+
<div style="display: flex; gap: 16px; align-items: flex-start;">
|
|
184
|
+
<jh-check-card
|
|
185
|
+
title="小尺寸"
|
|
186
|
+
description="Small size card"
|
|
187
|
+
size="small"
|
|
188
|
+
style="width: 150px;"
|
|
189
|
+
>
|
|
190
|
+
<div>小卡片</div>
|
|
191
|
+
</jh-check-card>
|
|
192
|
+
|
|
193
|
+
<jh-check-card
|
|
194
|
+
title="默认尺寸"
|
|
195
|
+
description="Default size card"
|
|
196
|
+
size="default"
|
|
197
|
+
style="width: 200px;"
|
|
198
|
+
>
|
|
199
|
+
<div>默认卡片</div>
|
|
200
|
+
</jh-check-card>
|
|
201
|
+
|
|
202
|
+
<jh-check-card
|
|
203
|
+
title="大尺寸"
|
|
204
|
+
description="Large size card"
|
|
205
|
+
size="large"
|
|
206
|
+
style="width: 250px;"
|
|
207
|
+
>
|
|
208
|
+
<div>大卡片</div>
|
|
209
|
+
</jh-check-card>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
`,
|
|
213
|
+
}),
|
|
214
|
+
parameters: {
|
|
215
|
+
docs: {
|
|
216
|
+
description: {
|
|
217
|
+
story: '不同尺寸的卡片:小、默认、大。',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// 选择框位置
|
|
224
|
+
export const CheckboxPositions = {
|
|
225
|
+
render: () => ({
|
|
226
|
+
components: { JhCheckCard },
|
|
227
|
+
template: `
|
|
228
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
229
|
+
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 500px;">
|
|
230
|
+
<jh-check-card
|
|
231
|
+
title="左上角"
|
|
232
|
+
description="Top Left"
|
|
233
|
+
checkbox-position="top-left"
|
|
234
|
+
:checked="true"
|
|
235
|
+
style="width: 200px;"
|
|
236
|
+
>
|
|
237
|
+
<div>选择框在左上角</div>
|
|
238
|
+
</jh-check-card>
|
|
239
|
+
|
|
240
|
+
<jh-check-card
|
|
241
|
+
title="右上角"
|
|
242
|
+
description="Top Right"
|
|
243
|
+
checkbox-position="top-right"
|
|
244
|
+
:checked="true"
|
|
245
|
+
style="width: 200px;"
|
|
246
|
+
>
|
|
247
|
+
<div>选择框在右上角</div>
|
|
248
|
+
</jh-check-card>
|
|
249
|
+
|
|
250
|
+
<jh-check-card
|
|
251
|
+
title="左下角"
|
|
252
|
+
description="Bottom Left"
|
|
253
|
+
checkbox-position="bottom-left"
|
|
254
|
+
:checked="true"
|
|
255
|
+
style="width: 200px;"
|
|
256
|
+
>
|
|
257
|
+
<div>选择框在左下角</div>
|
|
258
|
+
</jh-check-card>
|
|
259
|
+
|
|
260
|
+
<jh-check-card
|
|
261
|
+
title="右下角"
|
|
262
|
+
description="Bottom Right"
|
|
263
|
+
checkbox-position="bottom-right"
|
|
264
|
+
:checked="true"
|
|
265
|
+
style="width: 200px;"
|
|
266
|
+
>
|
|
267
|
+
<div>选择框在右下角</div>
|
|
268
|
+
</jh-check-card>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
`,
|
|
272
|
+
}),
|
|
273
|
+
parameters: {
|
|
274
|
+
docs: {
|
|
275
|
+
description: {
|
|
276
|
+
story: '选择框可以放置在卡片的四个角落。',
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
// 带封面图片
|
|
283
|
+
export const WithCover = {
|
|
284
|
+
render: () => ({
|
|
285
|
+
components: { JhCheckCard },
|
|
286
|
+
template: `
|
|
287
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
288
|
+
<div style="display: flex; gap: 16px;">
|
|
289
|
+
<jh-check-card
|
|
290
|
+
title="产品A"
|
|
291
|
+
description="高质量产品"
|
|
292
|
+
cover="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"
|
|
293
|
+
extra="¥299"
|
|
294
|
+
style="width: 200px;"
|
|
295
|
+
>
|
|
296
|
+
<div>产品详细信息</div>
|
|
297
|
+
</jh-check-card>
|
|
298
|
+
|
|
299
|
+
<jh-check-card
|
|
300
|
+
title="产品B"
|
|
301
|
+
description="性价比之选"
|
|
302
|
+
cover="https://gw.alipayobjects.com/zos/antfincdn/LlvErxo8H9/photo-1503185912284-5271ff81b9a8.webp"
|
|
303
|
+
extra="¥199"
|
|
304
|
+
:checked="true"
|
|
305
|
+
style="width: 200px;"
|
|
306
|
+
>
|
|
307
|
+
<div>产品详细信息</div>
|
|
308
|
+
</jh-check-card>
|
|
309
|
+
</div>
|
|
310
|
+
</div>
|
|
311
|
+
`,
|
|
312
|
+
}),
|
|
313
|
+
parameters: {
|
|
314
|
+
docs: {
|
|
315
|
+
description: {
|
|
316
|
+
story: '带封面图片的卡片,适合商品展示。',
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// 多选组合
|
|
323
|
+
export const MultipleSelection = {
|
|
324
|
+
render: () => ({
|
|
325
|
+
components: { JhCheckCard },
|
|
326
|
+
data() {
|
|
327
|
+
return {
|
|
328
|
+
selectedValues: ['option1', 'option3'],
|
|
329
|
+
options: [
|
|
330
|
+
{ value: 'option1', title: '选项一', description: '这是第一个选项' },
|
|
331
|
+
{ value: 'option2', title: '选项二', description: '这是第二个选项' },
|
|
332
|
+
{ value: 'option3', title: '选项三', description: '这是第三个选项' },
|
|
333
|
+
{ value: 'option4', title: '选项四', description: '这是第四个选项' },
|
|
334
|
+
],
|
|
335
|
+
};
|
|
336
|
+
},
|
|
337
|
+
methods: {
|
|
338
|
+
handleChange(checked, value) {
|
|
339
|
+
if (checked) {
|
|
340
|
+
if (!this.selectedValues.includes(value)) {
|
|
341
|
+
this.selectedValues.push(value);
|
|
342
|
+
}
|
|
343
|
+
} else {
|
|
344
|
+
const index = this.selectedValues.indexOf(value);
|
|
345
|
+
if (index > -1) {
|
|
346
|
+
this.selectedValues.splice(index, 1);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
template: `
|
|
352
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
353
|
+
<div style="margin-bottom: 16px;">
|
|
354
|
+
<strong>已选择:</strong>{{ selectedValues.join(', ') || '无' }}
|
|
355
|
+
</div>
|
|
356
|
+
|
|
357
|
+
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 500px;">
|
|
358
|
+
<jh-check-card
|
|
359
|
+
v-for="option in options"
|
|
360
|
+
:key="option.value"
|
|
361
|
+
:title="option.title"
|
|
362
|
+
:description="option.description"
|
|
363
|
+
:value="option.value"
|
|
364
|
+
:checked="selectedValues.includes(option.value)"
|
|
365
|
+
@change="handleChange"
|
|
366
|
+
style="width: 200px;"
|
|
367
|
+
>
|
|
368
|
+
<div>{{ option.description }}</div>
|
|
369
|
+
</jh-check-card>
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
`,
|
|
373
|
+
}),
|
|
374
|
+
parameters: {
|
|
375
|
+
docs: {
|
|
376
|
+
description: {
|
|
377
|
+
story: '多选卡片组合,支持选择多个选项。',
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// 单选组合
|
|
384
|
+
export const SingleSelection = {
|
|
385
|
+
render: () => ({
|
|
386
|
+
components: { JhCheckCard },
|
|
387
|
+
data() {
|
|
388
|
+
return {
|
|
389
|
+
selectedValue: 'plan2',
|
|
390
|
+
plans: [
|
|
391
|
+
{ value: 'plan1', title: '基础版', description: '适合个人用户', price: '免费' },
|
|
392
|
+
{ value: 'plan2', title: '专业版', description: '适合小团队', price: '¥99/月' },
|
|
393
|
+
{ value: 'plan3', title: '企业版', description: '适合大企业', price: '¥299/月' },
|
|
394
|
+
],
|
|
395
|
+
};
|
|
396
|
+
},
|
|
397
|
+
methods: {
|
|
398
|
+
handleChange(checked, value) {
|
|
399
|
+
if (checked) {
|
|
400
|
+
this.selectedValue = value;
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
template: `
|
|
405
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
406
|
+
<div style="margin-bottom: 16px;">
|
|
407
|
+
<strong>已选择套餐:</strong>{{ selectedValue }}
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
<div style="display: flex; gap: 16px;">
|
|
411
|
+
<jh-check-card
|
|
412
|
+
v-for="plan in plans"
|
|
413
|
+
:key="plan.value"
|
|
414
|
+
:title="plan.title"
|
|
415
|
+
:description="plan.description"
|
|
416
|
+
:value="plan.value"
|
|
417
|
+
:checked="selectedValue === plan.value"
|
|
418
|
+
:extra="plan.price"
|
|
419
|
+
@change="handleChange"
|
|
420
|
+
style="width: 200px;"
|
|
421
|
+
>
|
|
422
|
+
<div style="text-align: center; padding: 20px;">
|
|
423
|
+
<div style="font-size: 24px; font-weight: bold; color: #1890ff;">
|
|
424
|
+
{{ plan.price }}
|
|
425
|
+
</div>
|
|
426
|
+
</div>
|
|
427
|
+
</jh-check-card>
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
`,
|
|
431
|
+
}),
|
|
432
|
+
parameters: {
|
|
433
|
+
docs: {
|
|
434
|
+
description: {
|
|
435
|
+
story: '单选卡片组合,类似单选按钮组。',
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
// 禁用状态
|
|
442
|
+
export const Disabled = {
|
|
443
|
+
render: () => ({
|
|
444
|
+
components: { JhCheckCard },
|
|
445
|
+
template: `
|
|
446
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
447
|
+
<div style="display: flex; gap: 16px;">
|
|
448
|
+
<jh-check-card
|
|
449
|
+
title="正常状态"
|
|
450
|
+
description="可以正常选择"
|
|
451
|
+
style="width: 200px;"
|
|
452
|
+
>
|
|
453
|
+
<div>正常卡片</div>
|
|
454
|
+
</jh-check-card>
|
|
455
|
+
|
|
456
|
+
<jh-check-card
|
|
457
|
+
title="禁用状态"
|
|
458
|
+
description="无法选择"
|
|
459
|
+
:disabled="true"
|
|
460
|
+
style="width: 200px;"
|
|
461
|
+
>
|
|
462
|
+
<div>禁用卡片</div>
|
|
463
|
+
</jh-check-card>
|
|
464
|
+
|
|
465
|
+
<jh-check-card
|
|
466
|
+
title="禁用选中"
|
|
467
|
+
description="禁用且选中"
|
|
468
|
+
:disabled="true"
|
|
469
|
+
:checked="true"
|
|
470
|
+
style="width: 200px;"
|
|
471
|
+
>
|
|
472
|
+
<div>禁用选中卡片</div>
|
|
473
|
+
</jh-check-card>
|
|
474
|
+
</div>
|
|
475
|
+
</div>
|
|
476
|
+
`,
|
|
477
|
+
}),
|
|
478
|
+
parameters: {
|
|
479
|
+
docs: {
|
|
480
|
+
description: {
|
|
481
|
+
story: '禁用状态的卡片无法进行选择操作。',
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
// 加载状态
|
|
488
|
+
export const Loading = {
|
|
489
|
+
render: () => ({
|
|
490
|
+
components: { JhCheckCard },
|
|
491
|
+
template: `
|
|
492
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
493
|
+
<div style="display: flex; gap: 16px;">
|
|
494
|
+
<jh-check-card
|
|
495
|
+
title="正常状态"
|
|
496
|
+
description="正常显示"
|
|
497
|
+
style="width: 200px;"
|
|
498
|
+
>
|
|
499
|
+
<div>正常内容</div>
|
|
500
|
+
</jh-check-card>
|
|
501
|
+
|
|
502
|
+
<jh-check-card
|
|
503
|
+
title="加载中"
|
|
504
|
+
description="数据加载中"
|
|
505
|
+
:loading="true"
|
|
506
|
+
style="width: 200px;"
|
|
507
|
+
>
|
|
508
|
+
<div>加载中的内容</div>
|
|
509
|
+
</jh-check-card>
|
|
510
|
+
</div>
|
|
511
|
+
</div>
|
|
512
|
+
`,
|
|
513
|
+
}),
|
|
514
|
+
parameters: {
|
|
515
|
+
docs: {
|
|
516
|
+
description: {
|
|
517
|
+
story: '加载状态显示加载指示器。',
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
},
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
// 隐藏选择框
|
|
524
|
+
export const HideCheckbox = {
|
|
525
|
+
render: () => ({
|
|
526
|
+
components: { JhCheckCard },
|
|
527
|
+
data() {
|
|
528
|
+
return {
|
|
529
|
+
selectedCard: 'card2',
|
|
530
|
+
};
|
|
531
|
+
},
|
|
532
|
+
methods: {
|
|
533
|
+
handleSelect(value) {
|
|
534
|
+
this.selectedCard = value;
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
template: `
|
|
538
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
539
|
+
<div style="margin-bottom: 16px;">
|
|
540
|
+
<strong>选中卡片:</strong>{{ selectedCard }}
|
|
541
|
+
</div>
|
|
542
|
+
|
|
543
|
+
<div style="display: flex; gap: 16px;">
|
|
544
|
+
<jh-check-card
|
|
545
|
+
title="卡片1"
|
|
546
|
+
description="隐藏选择框"
|
|
547
|
+
value="card1"
|
|
548
|
+
:checked="selectedCard === 'card1'"
|
|
549
|
+
:hide-checkbox="true"
|
|
550
|
+
@click="handleSelect('card1')"
|
|
551
|
+
style="width: 200px;"
|
|
552
|
+
>
|
|
553
|
+
<div>点击整个卡片选择</div>
|
|
554
|
+
</jh-check-card>
|
|
555
|
+
|
|
556
|
+
<jh-check-card
|
|
557
|
+
title="卡片2"
|
|
558
|
+
description="隐藏选择框"
|
|
559
|
+
value="card2"
|
|
560
|
+
:checked="selectedCard === 'card2'"
|
|
561
|
+
:hide-checkbox="true"
|
|
562
|
+
@click="handleSelect('card2')"
|
|
563
|
+
style="width: 200px;"
|
|
564
|
+
>
|
|
565
|
+
<div>点击整个卡片选择</div>
|
|
566
|
+
</jh-check-card>
|
|
567
|
+
</div>
|
|
568
|
+
</div>
|
|
569
|
+
`,
|
|
570
|
+
}),
|
|
571
|
+
parameters: {
|
|
572
|
+
docs: {
|
|
573
|
+
description: {
|
|
574
|
+
story: '隐藏选择框,通过卡片边框和背景色显示选中状态。',
|
|
575
|
+
},
|
|
576
|
+
},
|
|
577
|
+
},
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// 自定义内容
|
|
581
|
+
export const CustomContent = {
|
|
582
|
+
render: () => ({
|
|
583
|
+
components: { JhCheckCard },
|
|
584
|
+
data() {
|
|
585
|
+
return {
|
|
586
|
+
selectedFeatures: ['feature1'],
|
|
587
|
+
};
|
|
588
|
+
},
|
|
589
|
+
methods: {
|
|
590
|
+
handleFeatureChange(checked, value) {
|
|
591
|
+
if (checked) {
|
|
592
|
+
if (!this.selectedFeatures.includes(value)) {
|
|
593
|
+
this.selectedFeatures.push(value);
|
|
594
|
+
}
|
|
595
|
+
} else {
|
|
596
|
+
const index = this.selectedFeatures.indexOf(value);
|
|
597
|
+
if (index > -1) {
|
|
598
|
+
this.selectedFeatures.splice(index, 1);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
},
|
|
603
|
+
template: `
|
|
604
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
605
|
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 800px;">
|
|
606
|
+
<jh-check-card
|
|
607
|
+
value="feature1"
|
|
608
|
+
:checked="selectedFeatures.includes('feature1')"
|
|
609
|
+
@change="handleFeatureChange"
|
|
610
|
+
style="width: 240px;"
|
|
611
|
+
>
|
|
612
|
+
<template #title>
|
|
613
|
+
<div style="display: flex; align-items: center;">
|
|
614
|
+
<v-icon color="primary" class="mr-2">mdi-rocket</v-icon>
|
|
615
|
+
高性能
|
|
616
|
+
</div>
|
|
617
|
+
</template>
|
|
618
|
+
<template #description>
|
|
619
|
+
<div style="color: #52c41a;">99.9% 可用性保证</div>
|
|
620
|
+
</template>
|
|
621
|
+
<div style="text-align: center; padding: 20px;">
|
|
622
|
+
<div style="font-size: 32px; margin-bottom: 8px;">⚡</div>
|
|
623
|
+
<div>闪电般的速度体验</div>
|
|
624
|
+
</div>
|
|
625
|
+
</jh-check-card>
|
|
626
|
+
|
|
627
|
+
<jh-check-card
|
|
628
|
+
value="feature2"
|
|
629
|
+
:checked="selectedFeatures.includes('feature2')"
|
|
630
|
+
@change="handleFeatureChange"
|
|
631
|
+
style="width: 240px;"
|
|
632
|
+
>
|
|
633
|
+
<template #title>
|
|
634
|
+
<div style="display: flex; align-items: center;">
|
|
635
|
+
<v-icon color="success" class="mr-2">mdi-shield-check</v-icon>
|
|
636
|
+
安全可靠
|
|
637
|
+
</div>
|
|
638
|
+
</template>
|
|
639
|
+
<template #description>
|
|
640
|
+
<div style="color: #1890ff;">企业级安全保障</div>
|
|
641
|
+
</template>
|
|
642
|
+
<div style="text-align: center; padding: 20px;">
|
|
643
|
+
<div style="font-size: 32px; margin-bottom: 8px;">🔒</div>
|
|
644
|
+
<div>数据加密传输</div>
|
|
645
|
+
</div>
|
|
646
|
+
</jh-check-card>
|
|
647
|
+
|
|
648
|
+
<jh-check-card
|
|
649
|
+
value="feature3"
|
|
650
|
+
:checked="selectedFeatures.includes('feature3')"
|
|
651
|
+
@change="handleFeatureChange"
|
|
652
|
+
style="width: 240px;"
|
|
653
|
+
>
|
|
654
|
+
<template #title>
|
|
655
|
+
<div style="display: flex; align-items: center;">
|
|
656
|
+
<v-icon color="warning" class="mr-2">mdi-account-group</v-icon>
|
|
657
|
+
团队协作
|
|
658
|
+
</div>
|
|
659
|
+
</template>
|
|
660
|
+
<template #description>
|
|
661
|
+
<div style="color: #faad14;">支持多人协作</div>
|
|
662
|
+
</template>
|
|
663
|
+
<div style="text-align: center; padding: 20px;">
|
|
664
|
+
<div style="font-size: 32px; margin-bottom: 8px;">👥</div>
|
|
665
|
+
<div>实时协作编辑</div>
|
|
666
|
+
</div>
|
|
667
|
+
</jh-check-card>
|
|
668
|
+
</div>
|
|
669
|
+
|
|
670
|
+
<div style="margin-top: 20px; padding: 16px; background: white; border-radius: 4px;">
|
|
671
|
+
<strong>已选择功能:</strong>
|
|
672
|
+
{{ selectedFeatures.length > 0 ? selectedFeatures.join(', ') : '无' }}
|
|
673
|
+
</div>
|
|
674
|
+
</div>
|
|
675
|
+
`,
|
|
676
|
+
}),
|
|
677
|
+
parameters: {
|
|
678
|
+
docs: {
|
|
679
|
+
description: {
|
|
680
|
+
story: '使用插槽自定义卡片内容,支持图标、颜色等个性化设计。',
|
|
681
|
+
},
|
|
682
|
+
},
|
|
683
|
+
},
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
// 响应式布局
|
|
687
|
+
export const ResponsiveLayout = {
|
|
688
|
+
render: () => ({
|
|
689
|
+
components: { JhCheckCard },
|
|
690
|
+
data() {
|
|
691
|
+
return {
|
|
692
|
+
selectedOptions: [],
|
|
693
|
+
options: Array.from({ length: 8 }, (_, i) => ({
|
|
694
|
+
value: `option${i + 1}`,
|
|
695
|
+
title: `选项 ${i + 1}`,
|
|
696
|
+
description: `这是第 ${i + 1} 个选项的描述`,
|
|
697
|
+
})),
|
|
698
|
+
};
|
|
699
|
+
},
|
|
700
|
+
methods: {
|
|
701
|
+
handleChange(checked, value) {
|
|
702
|
+
if (checked) {
|
|
703
|
+
if (!this.selectedOptions.includes(value)) {
|
|
704
|
+
this.selectedOptions.push(value);
|
|
705
|
+
}
|
|
706
|
+
} else {
|
|
707
|
+
const index = this.selectedOptions.indexOf(value);
|
|
708
|
+
if (index > -1) {
|
|
709
|
+
this.selectedOptions.splice(index, 1);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
},
|
|
714
|
+
template: `
|
|
715
|
+
<div style="background: rgb(240, 242, 245); padding: 20px;">
|
|
716
|
+
<div style="margin-bottom: 16px;">
|
|
717
|
+
<strong>已选择 {{ selectedOptions.length }} 项:</strong>
|
|
718
|
+
{{ selectedOptions.join(', ') || '无' }}
|
|
719
|
+
</div>
|
|
720
|
+
|
|
721
|
+
<div style="
|
|
722
|
+
display: grid;
|
|
723
|
+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
724
|
+
gap: 16px;
|
|
725
|
+
">
|
|
726
|
+
<jh-check-card
|
|
727
|
+
v-for="option in options"
|
|
728
|
+
:key="option.value"
|
|
729
|
+
:title="option.title"
|
|
730
|
+
:description="option.description"
|
|
731
|
+
:value="option.value"
|
|
732
|
+
:checked="selectedOptions.includes(option.value)"
|
|
733
|
+
@change="handleChange"
|
|
734
|
+
>
|
|
735
|
+
<div style="text-align: center; padding: 16px;">
|
|
736
|
+
<v-icon size="32" color="primary">mdi-check-circle</v-icon>
|
|
737
|
+
</div>
|
|
738
|
+
</jh-check-card>
|
|
739
|
+
</div>
|
|
740
|
+
</div>
|
|
741
|
+
`,
|
|
742
|
+
}),
|
|
743
|
+
parameters: {
|
|
744
|
+
docs: {
|
|
745
|
+
description: {
|
|
746
|
+
story: '响应式网格布局,自适应不同屏幕尺寸。',
|
|
747
|
+
},
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
};
|