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.
Files changed (112) hide show
  1. package/README.md +376 -0
  2. package/dist/jianghu-ui.css +2318 -0
  3. package/dist/jianghu-ui.js +2 -0
  4. package/dist/jianghu-ui.js.LICENSE.txt +1 -0
  5. package/package.json +56 -0
  6. package/src/Design.stories.mdx +195 -0
  7. package/src/Introduction.stories.mdx +148 -0
  8. package/src/components/JhAddressSelect/JhAddressSelect.md +250 -0
  9. package/src/components/JhAddressSelect/JhAddressSelect.stories.js +282 -0
  10. package/src/components/JhAddressSelect/JhAddressSelect.vue +261 -0
  11. package/src/components/JhCard/JhCard.md +246 -0
  12. package/src/components/JhCard/JhCard.stories.js +688 -0
  13. package/src/components/JhCard/JhCard.vue +604 -0
  14. package/src/components/JhCheckCard/JhCheckCard.md +245 -0
  15. package/src/components/JhCheckCard/JhCheckCard.stories.js +750 -0
  16. package/src/components/JhCheckCard/JhCheckCard.vue +476 -0
  17. package/src/components/JhConfirmDialog/JhConfirmDialog.md +70 -0
  18. package/src/components/JhConfirmDialog/JhConfirmDialog.stories.js +550 -0
  19. package/src/components/JhConfirmDialog/JhConfirmDialog.vue +181 -0
  20. package/src/components/JhDateRangePicker/JhDateRangePicker.md +56 -0
  21. package/src/components/JhDateRangePicker/JhDateRangePicker.stories.js +320 -0
  22. package/src/components/JhDateRangePicker/JhDateRangePicker.vue +307 -0
  23. package/src/components/JhDescriptions/JhDescriptions.md +724 -0
  24. package/src/components/JhDescriptions/JhDescriptions.stories.js +858 -0
  25. package/src/components/JhDescriptions/JhDescriptions.vue +933 -0
  26. package/src/components/JhDraggable/JhDraggable.md +66 -0
  27. package/src/components/JhDraggable/JhDraggable.stories.js +161 -0
  28. package/src/components/JhDraggable/JhDraggable.vue +254 -0
  29. package/src/components/JhDrawer/JhDrawer.md +68 -0
  30. package/src/components/JhDrawer/JhDrawer.stories.js +478 -0
  31. package/src/components/JhDrawer/JhDrawer.vue +281 -0
  32. package/src/components/JhDrawerForm/JhDrawerForm.md +69 -0
  33. package/src/components/JhDrawerForm/JhDrawerForm.stories.js +492 -0
  34. package/src/components/JhDrawerForm/JhDrawerForm.vue +297 -0
  35. package/src/components/JhEditableTable/JhEditableTable.md +507 -0
  36. package/src/components/JhEditableTable/JhEditableTable.stories.js +615 -0
  37. package/src/components/JhEditableTable/JhEditableTable.vue +685 -0
  38. package/src/components/JhFileInput/JhFileInput.md +56 -0
  39. package/src/components/JhFileInput/JhFileInput.stories.js +103 -0
  40. package/src/components/JhFileInput/JhFileInput.vue +253 -0
  41. package/src/components/JhForm/JhForm.md +676 -0
  42. package/src/components/JhForm/JhForm.stories.js +1375 -0
  43. package/src/components/JhForm/JhForm.vue +657 -0
  44. package/src/components/JhFormField/JhFormField.stories.js +217 -0
  45. package/src/components/JhFormField/JhFormField.vue +439 -0
  46. package/src/components/JhFormFields/JhFormFields.md +647 -0
  47. package/src/components/JhFormFields/JhFormFields.stories.js +922 -0
  48. package/src/components/JhFormFields/JhFormFields.vue +998 -0
  49. package/src/components/JhFormList/JhFormList.md +303 -0
  50. package/src/components/JhFormList/JhFormList.stories.js +661 -0
  51. package/src/components/JhFormList/JhFormList.vue +1127 -0
  52. package/src/components/JhJsonEditor/JhJsonEditor.md +54 -0
  53. package/src/components/JhJsonEditor/JhJsonEditor.stories.js +157 -0
  54. package/src/components/JhJsonEditor/JhJsonEditor.vue +178 -0
  55. package/src/components/JhLayout/JhLayout.md +580 -0
  56. package/src/components/JhLayout/JhLayout.stories.js +414 -0
  57. package/src/components/JhLayout/JhLayout.vue +387 -0
  58. package/src/components/JhList/JhList.md +441 -0
  59. package/src/components/JhList/JhList.stories.js +524 -0
  60. package/src/components/JhList/JhList.vue +571 -0
  61. package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +56 -0
  62. package/src/components/JhMarkdownEditor/JhMarkdownEditor.stories.js +191 -0
  63. package/src/components/JhMarkdownEditor/JhMarkdownEditor.vue +188 -0
  64. package/src/components/JhMask/JhMask.md +62 -0
  65. package/src/components/JhMask/JhMask.stories.js +270 -0
  66. package/src/components/JhMask/JhMask.vue +123 -0
  67. package/src/components/JhMenu/JhMenu.md +85 -0
  68. package/src/components/JhMenu/JhMenu.stories.js +384 -0
  69. package/src/components/JhMenu/JhMenu.vue +545 -0
  70. package/src/components/JhModal/JhModal.md +68 -0
  71. package/src/components/JhModal/JhModal.stories.js +562 -0
  72. package/src/components/JhModal/JhModal.vue +235 -0
  73. package/src/components/JhModalForm/JhModalForm.md +69 -0
  74. package/src/components/JhModalForm/JhModalForm.stories.js +592 -0
  75. package/src/components/JhModalForm/JhModalForm.vue +298 -0
  76. package/src/components/JhPageContainer/JhPageContainer.md +409 -0
  77. package/src/components/JhPageContainer/JhPageContainer.stories.js +209 -0
  78. package/src/components/JhPageContainer/JhPageContainer.vue +72 -0
  79. package/src/components/JhQueryFilter/JhQueryFilter.md +77 -0
  80. package/src/components/JhQueryFilter/JhQueryFilter.stories.js +684 -0
  81. package/src/components/JhQueryFilter/JhQueryFilter.vue +429 -0
  82. package/src/components/JhScene/JhScene.md +64 -0
  83. package/src/components/JhScene/JhScene.stories.js +317 -0
  84. package/src/components/JhScene/JhScene.vue +376 -0
  85. package/src/components/JhStatisticCard/JhStatisticCard.md +363 -0
  86. package/src/components/JhStatisticCard/JhStatisticCard.stories.js +847 -0
  87. package/src/components/JhStatisticCard/JhStatisticCard.vue +459 -0
  88. package/src/components/JhStepsForm/JhStepsForm.md +666 -0
  89. package/src/components/JhStepsForm/JhStepsForm.stories.js +1224 -0
  90. package/src/components/JhStepsForm/JhStepsForm.vue +749 -0
  91. package/src/components/JhTable/JhTable.md +730 -0
  92. package/src/components/JhTable/JhTable.stories.js +1444 -0
  93. package/src/components/JhTable/JhTable.vue +2298 -0
  94. package/src/components/JhTableAttachment/JhTableAttachment.md +70 -0
  95. package/src/components/JhTableAttachment/JhTableAttachment.stories.js +198 -0
  96. package/src/components/JhTableAttachment/JhTableAttachment.vue +264 -0
  97. package/src/components/JhToast/JhToast.md +67 -0
  98. package/src/components/JhToast/JhToast.stories.js +386 -0
  99. package/src/components/JhToast/JhToast.vue +239 -0
  100. package/src/components/JhTreeSelect/JhTreeSelect.md +82 -0
  101. package/src/components/JhTreeSelect/JhTreeSelect.stories.js +391 -0
  102. package/src/components/JhTreeSelect/JhTreeSelect.vue +727 -0
  103. package/src/components/JhWaterMark/JhWaterMark.md +190 -0
  104. package/src/components/JhWaterMark/JhWaterMark.stories.js +675 -0
  105. package/src/components/JhWaterMark/JhWaterMark.vue +351 -0
  106. package/src/components/README.md +52 -0
  107. package/src/index.js +135 -0
  108. package/src/style/globalCSSJHV4.css +348 -0
  109. package/src/style/globalCSSVuetifyV4.css +637 -0
  110. package/src/style/storybook.css +4 -0
  111. package/src/tailwind.css +3 -0
  112. package/src/utils/vuetify.js +31 -0
@@ -0,0 +1,847 @@
1
+ import JhStatisticCard from './JhStatisticCard.vue';
2
+
3
+
4
+ export default {
5
+ title: '布局/JhStatisticCard - 统计卡片',
6
+ component: JhStatisticCard,
7
+ tags: ['autodocs'],
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: `
12
+ 指标卡组件,参考 Ant Design Pro StatisticCard 设计规范。用于展示统计数据、趋势和图表,适用于数据大屏、仪表盘等场景。
13
+
14
+ ## 使用前提
15
+
16
+ 需要在 HTML 中引入 echarts 库:
17
+
18
+ \`\`\`html
19
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vue-echarts@8.0.1/dist/style.min.css">
20
+ <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
21
+ <script src="https://cdn.jsdelivr.net/npm/vue-echarts@8.0.1/dist/index.min.js"></script>
22
+ \`\`\`
23
+ `,
24
+ },
25
+ },
26
+ },
27
+ argTypes: {
28
+ title: {
29
+ control: 'text',
30
+ description: '卡片标题',
31
+ table: {
32
+ type: { summary: 'string' },
33
+ defaultValue: { summary: '' },
34
+ },
35
+ },
36
+ tooltip: {
37
+ control: 'text',
38
+ description: '标题提示信息',
39
+ table: {
40
+ type: { summary: 'string' },
41
+ defaultValue: { summary: '' },
42
+ },
43
+ },
44
+ value: {
45
+ control: 'number',
46
+ description: '统计数值',
47
+ table: {
48
+ type: { summary: 'number | string' },
49
+ defaultValue: { summary: '0' },
50
+ },
51
+ },
52
+ prefix: {
53
+ control: 'text',
54
+ description: '数值前缀',
55
+ table: {
56
+ type: { summary: 'string' },
57
+ defaultValue: { summary: '' },
58
+ },
59
+ },
60
+ suffix: {
61
+ control: 'text',
62
+ description: '数值后缀',
63
+ table: {
64
+ type: { summary: 'string' },
65
+ defaultValue: { summary: '' },
66
+ },
67
+ },
68
+ precision: {
69
+ control: 'number',
70
+ description: '数值精度(小数位数)',
71
+ table: {
72
+ type: { summary: 'number' },
73
+ defaultValue: { summary: '0' },
74
+ },
75
+ },
76
+ valueColor: {
77
+ control: 'color',
78
+ description: '数值颜色',
79
+ table: {
80
+ type: { summary: 'string' },
81
+ defaultValue: { summary: '' },
82
+ },
83
+ },
84
+ trend: {
85
+ control: 'text',
86
+ description: '趋势文本',
87
+ table: {
88
+ type: { summary: 'string' },
89
+ defaultValue: { summary: '' },
90
+ },
91
+ },
92
+ trendType: {
93
+ control: 'select',
94
+ options: ['up', 'down'],
95
+ description: '趋势类型',
96
+ table: {
97
+ type: { summary: 'string' },
98
+ defaultValue: { summary: 'up' },
99
+ },
100
+ },
101
+ description: {
102
+ control: 'text',
103
+ description: '描述信息',
104
+ table: {
105
+ type: { summary: 'string' },
106
+ defaultValue: { summary: '' },
107
+ },
108
+ },
109
+ footer: {
110
+ control: 'text',
111
+ description: '底部信息',
112
+ table: {
113
+ type: { summary: 'string' },
114
+ defaultValue: { summary: '' },
115
+ },
116
+ },
117
+ chartOption: {
118
+ control: 'object',
119
+ description: 'ECharts 图表配置',
120
+ table: {
121
+ type: { summary: 'object' },
122
+ defaultValue: { summary: 'null' },
123
+ },
124
+ },
125
+ chartHeight: {
126
+ control: 'number',
127
+ description: '图表高度',
128
+ table: {
129
+ type: { summary: 'number | string' },
130
+ defaultValue: { summary: '46' },
131
+ },
132
+ },
133
+ chartWidth: {
134
+ control: 'number',
135
+ description: '图表宽度',
136
+ table: {
137
+ type: { summary: 'number | string' },
138
+ defaultValue: { summary: '100' },
139
+ },
140
+ },
141
+ bordered: {
142
+ control: 'boolean',
143
+ description: '是否显示边框',
144
+ table: {
145
+ type: { summary: 'boolean' },
146
+ defaultValue: { summary: 'true' },
147
+ },
148
+ },
149
+ loading: {
150
+ control: 'boolean',
151
+ description: '加载状态',
152
+ table: {
153
+ type: { summary: 'boolean' },
154
+ defaultValue: { summary: 'false' },
155
+ },
156
+ },
157
+ layout: {
158
+ control: 'select',
159
+ options: ['horizontal', 'vertical'],
160
+ description: '布局方向',
161
+ table: {
162
+ type: { summary: 'string' },
163
+ defaultValue: { summary: 'horizontal' },
164
+ },
165
+ },
166
+ },
167
+ };
168
+
169
+ // 基础用法
170
+ export const Basic = {
171
+ render: (args) => ({
172
+ components: { JhStatisticCard },
173
+ setup() {
174
+ return { args };
175
+ },
176
+ template: `
177
+ <div style="padding: 20px; background: #f0f2f5;">
178
+ <jh-statistic-card
179
+ v-bind="args"
180
+ title="总销售额"
181
+ :value="126560"
182
+ prefix="¥"
183
+ trend="12.5%"
184
+ trend-type="up"
185
+ description="周同比"
186
+ />
187
+ </div>
188
+ `,
189
+ }),
190
+ parameters: {
191
+ docs: {
192
+ description: {
193
+ story: '最基础的用法,展示统计数值和趋势。',
194
+ },
195
+ },
196
+ },
197
+ };
198
+
199
+ // 带图表的指标卡
200
+ export const WithLineChart = {
201
+ render: () => ({
202
+ components: { JhStatisticCard },
203
+ data() {
204
+ return {
205
+ chartOption: {
206
+ grid: {
207
+ left: 0,
208
+ right: 0,
209
+ top: 0,
210
+ bottom: 0,
211
+ },
212
+ xAxis: {
213
+ type: 'category',
214
+ show: false,
215
+ data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
216
+ },
217
+ yAxis: {
218
+ type: 'value',
219
+ show: false,
220
+ },
221
+ series: [
222
+ {
223
+ data: [820, 932, 901, 934, 1290, 1330, 1320],
224
+ type: 'line',
225
+ smooth: true,
226
+ symbol: 'none',
227
+ lineStyle: {
228
+ color: '#1890ff',
229
+ width: 2,
230
+ },
231
+ areaStyle: {
232
+ color: {
233
+ type: 'linear',
234
+ x: 0,
235
+ y: 0,
236
+ x2: 0,
237
+ y2: 1,
238
+ colorStops: [
239
+ { offset: 0, color: 'rgba(24, 144, 255, 0.3)' },
240
+ { offset: 1, color: 'rgba(24, 144, 255, 0)' },
241
+ ],
242
+ },
243
+ },
244
+ },
245
+ ],
246
+ },
247
+ };
248
+ },
249
+ template: `
250
+ <div style="padding: 20px; background: #f0f2f5;">
251
+ <jh-statistic-card
252
+ title="访问量"
253
+ :value="8846"
254
+ trend="8.5%"
255
+ trend-type="up"
256
+ description="日同比"
257
+ :chart-option="chartOption"
258
+ :chart-width="120"
259
+ :chart-height="46"
260
+ />
261
+ </div>
262
+ `,
263
+ }),
264
+ parameters: {
265
+ docs: {
266
+ description: {
267
+ story: '带折线图的指标卡,使用 ECharts 展示趋势数据。',
268
+ },
269
+ },
270
+ },
271
+ };
272
+
273
+ // 带柱状图的指标卡
274
+ export const WithBarChart = {
275
+ render: () => ({
276
+ components: { JhStatisticCard },
277
+ data() {
278
+ return {
279
+ chartOption: {
280
+ grid: {
281
+ left: 0,
282
+ right: 0,
283
+ top: 0,
284
+ bottom: 0,
285
+ },
286
+ xAxis: {
287
+ type: 'category',
288
+ show: false,
289
+ data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
290
+ },
291
+ yAxis: {
292
+ type: 'value',
293
+ show: false,
294
+ },
295
+ series: [
296
+ {
297
+ data: [120, 200, 150, 80, 70, 110, 130],
298
+ type: 'bar',
299
+ barWidth: 4,
300
+ itemStyle: {
301
+ color: '#52c41a',
302
+ borderRadius: [2, 2, 0, 0],
303
+ },
304
+ },
305
+ ],
306
+ },
307
+ };
308
+ },
309
+ template: `
310
+ <div style="padding: 20px; background: #f0f2f5;">
311
+ <jh-statistic-card
312
+ title="支付笔数"
313
+ :value="6560"
314
+ trend="5.2%"
315
+ trend-type="down"
316
+ description="周同比"
317
+ :chart-option="chartOption"
318
+ :chart-width="120"
319
+ :chart-height="46"
320
+ />
321
+ </div>
322
+ `,
323
+ }),
324
+ parameters: {
325
+ docs: {
326
+ description: {
327
+ story: '带柱状图的指标卡,适合展示离散数据。',
328
+ },
329
+ },
330
+ },
331
+ };
332
+
333
+ // 多个指标卡组合
334
+ export const CardGroup = {
335
+ render: () => ({
336
+ components: { JhStatisticCard },
337
+ data() {
338
+ return {
339
+ lineChartOption: {
340
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
341
+ xAxis: { type: 'category', show: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
342
+ yAxis: { type: 'value', show: false },
343
+ series: [{
344
+ data: [820, 932, 901, 934, 1290, 1330, 1320],
345
+ type: 'line',
346
+ smooth: true,
347
+ symbol: 'none',
348
+ lineStyle: { color: '#1890ff', width: 2 },
349
+ areaStyle: {
350
+ color: {
351
+ type: 'linear',
352
+ x: 0, y: 0, x2: 0, y2: 1,
353
+ colorStops: [
354
+ { offset: 0, color: 'rgba(24, 144, 255, 0.3)' },
355
+ { offset: 1, color: 'rgba(24, 144, 255, 0)' },
356
+ ],
357
+ },
358
+ },
359
+ }],
360
+ },
361
+ barChartOption: {
362
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
363
+ xAxis: { type: 'category', show: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
364
+ yAxis: { type: 'value', show: false },
365
+ series: [{
366
+ data: [120, 200, 150, 80, 70, 110, 130],
367
+ type: 'bar',
368
+ barWidth: 4,
369
+ itemStyle: { color: '#52c41a', borderRadius: [2, 2, 0, 0] },
370
+ }],
371
+ },
372
+ };
373
+ },
374
+ template: `
375
+ <div style="padding: 20px; background: #f0f2f5;">
376
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px;">
377
+ <jh-statistic-card
378
+ title="总销售额"
379
+ :value="126560"
380
+ prefix="¥"
381
+ trend="12.5%"
382
+ trend-type="up"
383
+ description="周同比"
384
+ :chart-option="lineChartOption"
385
+ :chart-width="100"
386
+ />
387
+ <jh-statistic-card
388
+ title="访问量"
389
+ :value="8846"
390
+ trend="8.5%"
391
+ trend-type="up"
392
+ description="日同比"
393
+ :chart-option="lineChartOption"
394
+ :chart-width="100"
395
+ />
396
+ <jh-statistic-card
397
+ title="支付笔数"
398
+ :value="6560"
399
+ trend="5.2%"
400
+ trend-type="down"
401
+ description="周同比"
402
+ :chart-option="barChartOption"
403
+ :chart-width="100"
404
+ />
405
+ <jh-statistic-card
406
+ title="运营活动效果"
407
+ :value="78"
408
+ suffix="%"
409
+ trend="2.1%"
410
+ trend-type="up"
411
+ description="周同比"
412
+ :chart-option="lineChartOption"
413
+ :chart-width="100"
414
+ />
415
+ </div>
416
+ </div>
417
+ `,
418
+ }),
419
+ parameters: {
420
+ docs: {
421
+ description: {
422
+ story: '多个指标卡组合展示,适用于数据大屏和仪表盘场景。',
423
+ },
424
+ },
425
+ },
426
+ };
427
+
428
+ // 自定义颜色
429
+ export const CustomColor = {
430
+ render: () => ({
431
+ components: { JhStatisticCard },
432
+ data() {
433
+ return {
434
+ chartOption: {
435
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
436
+ xAxis: { type: 'category', show: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
437
+ yAxis: { type: 'value', show: false },
438
+ series: [{
439
+ data: [820, 932, 901, 934, 1290, 1330, 1320],
440
+ type: 'line',
441
+ smooth: true,
442
+ symbol: 'none',
443
+ lineStyle: { color: '#f5222d', width: 2 },
444
+ areaStyle: {
445
+ color: {
446
+ type: 'linear',
447
+ x: 0, y: 0, x2: 0, y2: 1,
448
+ colorStops: [
449
+ { offset: 0, color: 'rgba(245, 34, 45, 0.3)' },
450
+ { offset: 1, color: 'rgba(245, 34, 45, 0)' },
451
+ ],
452
+ },
453
+ },
454
+ }],
455
+ },
456
+ };
457
+ },
458
+ template: `
459
+ <div style="padding: 20px; background: #f0f2f5;">
460
+ <jh-statistic-card
461
+ title="异常订单"
462
+ :value="234"
463
+ value-color="#f5222d"
464
+ trend="15.3%"
465
+ trend-type="down"
466
+ description="周同比"
467
+ :chart-option="chartOption"
468
+ :chart-width="100"
469
+ />
470
+ </div>
471
+ `,
472
+ }),
473
+ parameters: {
474
+ docs: {
475
+ description: {
476
+ story: '自定义数值颜色和图表颜色,用于突出显示特殊数据。',
477
+ },
478
+ },
479
+ },
480
+ };
481
+
482
+ // 带底部信息
483
+ export const WithFooter = {
484
+ render: () => ({
485
+ components: { JhStatisticCard },
486
+ template: `
487
+ <div style="padding: 20px; background: #f0f2f5;">
488
+ <jh-statistic-card
489
+ title="转化率"
490
+ :value="60.5"
491
+ :precision="1"
492
+ suffix="%"
493
+ trend="3.2%"
494
+ trend-type="up"
495
+ description="周同比"
496
+ footer="日均转化率 58.2%"
497
+ />
498
+ </div>
499
+ `,
500
+ }),
501
+ parameters: {
502
+ docs: {
503
+ description: {
504
+ story: '带底部信息的指标卡,可以展示额外的统计信息。',
505
+ },
506
+ },
507
+ },
508
+ };
509
+
510
+ // 垂直布局
511
+ export const VerticalLayout = {
512
+ render: () => ({
513
+ components: { JhStatisticCard },
514
+ data() {
515
+ return {
516
+ chartOption: {
517
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
518
+ xAxis: { type: 'category', show: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
519
+ yAxis: { type: 'value', show: false },
520
+ series: [{
521
+ data: [820, 932, 901, 934, 1290, 1330, 1320],
522
+ type: 'line',
523
+ smooth: true,
524
+ symbol: 'none',
525
+ lineStyle: { color: '#1890ff', width: 2 },
526
+ areaStyle: {
527
+ color: {
528
+ type: 'linear',
529
+ x: 0, y: 0, x2: 0, y2: 1,
530
+ colorStops: [
531
+ { offset: 0, color: 'rgba(24, 144, 255, 0.3)' },
532
+ { offset: 1, color: 'rgba(24, 144, 255, 0)' },
533
+ ],
534
+ },
535
+ },
536
+ }],
537
+ },
538
+ };
539
+ },
540
+ template: `
541
+ <div style="padding: 20px; background: #f0f2f5;">
542
+ <jh-statistic-card
543
+ title="总销售额"
544
+ :value="126560"
545
+ prefix="¥"
546
+ trend="12.5%"
547
+ trend-type="up"
548
+ description="周同比"
549
+ layout="vertical"
550
+ :chart-option="chartOption"
551
+ :chart-width="'100%'"
552
+ :chart-height="100"
553
+ />
554
+ </div>
555
+ `,
556
+ }),
557
+ parameters: {
558
+ docs: {
559
+ description: {
560
+ story: '垂直布局的指标卡,图表显示在数据下方。',
561
+ },
562
+ },
563
+ },
564
+ };
565
+
566
+ // 无边框
567
+ export const NoBorder = {
568
+ render: () => ({
569
+ components: { JhStatisticCard },
570
+ data() {
571
+ return {
572
+ chartOption: {
573
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
574
+ xAxis: { type: 'category', show: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
575
+ yAxis: { type: 'value', show: false },
576
+ series: [{
577
+ data: [820, 932, 901, 934, 1290, 1330, 1320],
578
+ type: 'line',
579
+ smooth: true,
580
+ symbol: 'none',
581
+ lineStyle: { color: '#1890ff', width: 2 },
582
+ }],
583
+ },
584
+ };
585
+ },
586
+ template: `
587
+ <div style="padding: 20px; background: #f0f2f5;">
588
+ <jh-statistic-card
589
+ title="访问量"
590
+ :value="8846"
591
+ trend="8.5%"
592
+ trend-type="up"
593
+ description="日同比"
594
+ :bordered="false"
595
+ :chart-option="chartOption"
596
+ :chart-width="100"
597
+ />
598
+ </div>
599
+ `,
600
+ }),
601
+ parameters: {
602
+ docs: {
603
+ description: {
604
+ story: '无边框的指标卡,适合在已有背景的容器中使用。',
605
+ },
606
+ },
607
+ },
608
+ };
609
+
610
+ // 自定义插槽
611
+ export const CustomSlots = {
612
+ render: () => ({
613
+ components: { JhStatisticCard },
614
+ data() {
615
+ return {
616
+ chartOption: {
617
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
618
+ xAxis: { type: 'category', show: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
619
+ yAxis: { type: 'value', show: false },
620
+ series: [{
621
+ data: [820, 932, 901, 934, 1290, 1330, 1320],
622
+ type: 'line',
623
+ smooth: true,
624
+ symbol: 'none',
625
+ lineStyle: { color: '#1890ff', width: 2 },
626
+ }],
627
+ },
628
+ };
629
+ },
630
+ template: `
631
+ <div style="padding: 20px; background: #f0f2f5;">
632
+ <jh-statistic-card :chart-option="chartOption" :chart-width="100">
633
+ <template #title>
634
+ <div style="display: flex; align-items: center;">
635
+ <v-icon small color="primary" class="mr-2">mdi-chart-line</v-icon>
636
+ <span style="font-weight: 500;">自定义标题</span>
637
+ </div>
638
+ </template>
639
+ <template #value>
640
+ <span style="color: #1890ff; font-size: 32px; font-weight: bold;">¥126,560</span>
641
+ </template>
642
+ <template #trend>
643
+ <div style="color: #52c41a;">
644
+ <v-icon small color="success">mdi-arrow-up</v-icon>
645
+ <span>增长 12.5%</span>
646
+ </div>
647
+ </template>
648
+ <template #description>
649
+ <span style="color: #999;">较上周增长明显</span>
650
+ </template>
651
+ <template #footer>
652
+ <div style="display: flex; justify-content: space-between;">
653
+ <span>日均销售额 ¥18,080</span>
654
+ <a href="#" style="color: #1890ff;">查看详情 ></a>
655
+ </div>
656
+ </template>
657
+ </jh-statistic-card>
658
+ </div>
659
+ `,
660
+ }),
661
+ parameters: {
662
+ docs: {
663
+ description: {
664
+ story: '使用插槽自定义各个区域的内容,实现更灵活的布局。',
665
+ },
666
+ },
667
+ },
668
+ };
669
+
670
+ // 仪表盘示例
671
+ export const Dashboard = {
672
+ render: () => ({
673
+ components: { JhStatisticCard },
674
+ data() {
675
+ return {
676
+ salesChart: {
677
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
678
+ xAxis: { type: 'category', show: false, data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'] },
679
+ yAxis: { type: 'value', show: false },
680
+ series: [{
681
+ data: [820, 932, 901, 934, 1290, 1330, 1320, 1450, 1500, 1600, 1700, 1800],
682
+ type: 'line',
683
+ smooth: true,
684
+ symbol: 'none',
685
+ lineStyle: { color: '#1890ff', width: 2 },
686
+ areaStyle: {
687
+ color: {
688
+ type: 'linear',
689
+ x: 0, y: 0, x2: 0, y2: 1,
690
+ colorStops: [
691
+ { offset: 0, color: 'rgba(24, 144, 255, 0.3)' },
692
+ { offset: 1, color: 'rgba(24, 144, 255, 0)' },
693
+ ],
694
+ },
695
+ },
696
+ }],
697
+ },
698
+ visitsChart: {
699
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
700
+ xAxis: { type: 'category', show: false, data: Array.from({ length: 30 }, (_, i) => i + 1) },
701
+ yAxis: { type: 'value', show: false },
702
+ series: [{
703
+ data: Array.from({ length: 30 }, () => Math.floor(Math.random() * 1000) + 500),
704
+ type: 'bar',
705
+ barWidth: 3,
706
+ itemStyle: { color: '#52c41a', borderRadius: [2, 2, 0, 0] },
707
+ }],
708
+ },
709
+ ordersChart: {
710
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
711
+ xAxis: { type: 'category', show: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
712
+ yAxis: { type: 'value', show: false },
713
+ series: [{
714
+ data: [320, 432, 301, 434, 590, 530, 520],
715
+ type: 'line',
716
+ smooth: true,
717
+ symbol: 'none',
718
+ lineStyle: { color: '#faad14', width: 2 },
719
+ }],
720
+ },
721
+ conversionChart: {
722
+ grid: { left: 0, right: 0, top: 0, bottom: 0 },
723
+ xAxis: { type: 'category', show: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
724
+ yAxis: { type: 'value', show: false },
725
+ series: [{
726
+ data: [60, 65, 58, 70, 68, 72, 75],
727
+ type: 'line',
728
+ smooth: true,
729
+ symbol: 'none',
730
+ lineStyle: { color: '#722ed1', width: 2 },
731
+ areaStyle: {
732
+ color: {
733
+ type: 'linear',
734
+ x: 0, y: 0, x2: 0, y2: 1,
735
+ colorStops: [
736
+ { offset: 0, color: 'rgba(114, 46, 209, 0.3)' },
737
+ { offset: 1, color: 'rgba(114, 46, 209, 0)' },
738
+ ],
739
+ },
740
+ },
741
+ }],
742
+ },
743
+ };
744
+ },
745
+ template: `
746
+ <div style="padding: 20px; background: #f0f2f5;">
747
+ <h2 style="margin-bottom: 20px; color: rgba(0, 0, 0, 0.85);">数据概览</h2>
748
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px;">
749
+ <jh-statistic-card
750
+ title="总销售额"
751
+ :value="126560"
752
+ prefix="¥"
753
+ trend="12.5%"
754
+ trend-type="up"
755
+ description="周同比 12.5%"
756
+ :chart-option="salesChart"
757
+ :chart-width="120"
758
+ footer="日均销售额 ¥18,080"
759
+ />
760
+ <jh-statistic-card
761
+ title="访问量"
762
+ :value="8846"
763
+ trend="8.5%"
764
+ trend-type="up"
765
+ description="日同比 8.5%"
766
+ :chart-option="visitsChart"
767
+ :chart-width="120"
768
+ footer="日均访问量 1,234"
769
+ />
770
+ <jh-statistic-card
771
+ title="支付笔数"
772
+ :value="6560"
773
+ trend="5.2%"
774
+ trend-type="down"
775
+ description="周同比 -5.2%"
776
+ :chart-option="ordersChart"
777
+ :chart-width="120"
778
+ footer="日均支付笔数 937"
779
+ />
780
+ <jh-statistic-card
781
+ title="转化率"
782
+ :value="78.5"
783
+ :precision="1"
784
+ suffix="%"
785
+ trend="2.1%"
786
+ trend-type="up"
787
+ description="周同比 2.1%"
788
+ :chart-option="conversionChart"
789
+ :chart-width="120"
790
+ footer="日均转化率 76.3%"
791
+ />
792
+ </div>
793
+
794
+ <h2 style="margin-bottom: 20px; color: rgba(0, 0, 0, 0.85);">运营数据</h2>
795
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px;">
796
+ <jh-statistic-card
797
+ title="新增用户"
798
+ :value="1234"
799
+ trend="18.2%"
800
+ trend-type="up"
801
+ description="月同比"
802
+ :chart-option="visitsChart"
803
+ :chart-width="120"
804
+ />
805
+ <jh-statistic-card
806
+ title="活跃用户"
807
+ :value="5678"
808
+ trend="3.5%"
809
+ trend-type="up"
810
+ description="月同比"
811
+ :chart-option="salesChart"
812
+ :chart-width="120"
813
+ />
814
+ <jh-statistic-card
815
+ title="用户留存率"
816
+ :value="85.2"
817
+ :precision="1"
818
+ suffix="%"
819
+ trend="1.2%"
820
+ trend-type="down"
821
+ description="月同比"
822
+ :chart-option="conversionChart"
823
+ :chart-width="120"
824
+ />
825
+ <jh-statistic-card
826
+ title="平均响应时间"
827
+ :value="234"
828
+ suffix="ms"
829
+ trend="5.8%"
830
+ trend-type="down"
831
+ description="周同比"
832
+ value-color="#52c41a"
833
+ :chart-option="ordersChart"
834
+ :chart-width="120"
835
+ />
836
+ </div>
837
+ </div>
838
+ `,
839
+ }),
840
+ parameters: {
841
+ docs: {
842
+ description: {
843
+ story: '完整的仪表盘示例,展示多个指标卡的组合使用。',
844
+ },
845
+ },
846
+ },
847
+ };