jianghu-ui 1.0.6 → 1.0.7
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/dist/jianghu-ui.css +181 -110
- package/dist/jianghu-ui.js +1 -1
- package/package.json +1 -1
- package/src/components/JhDrawer/JhDrawer.stories.js +6 -6
- package/src/components/JhDrawerForm/JhDrawerForm.vue +1 -1
- package/src/components/JhForm/JhForm.stories.js +114 -95
- package/src/components/JhForm/JhForm.vue +148 -21
- package/src/components/JhFormFields/JhFormFields.vue +33 -14
- package/src/components/JhModal/JhModal.stories.js +6 -6
- package/src/components/JhModal/JhModal.vue +1 -1
- package/src/components/JhModalForm/JhModalForm.vue +1 -1
- package/src/components/JhTable/JhTable.stories.js +134 -167
- package/src/components/JhTable/JhTable.vue +83 -23
- package/src/style/globalCSSVuetifyV4.css +1 -2
- package/src/components/JhAddressSelect/JhAddressSelect.md +0 -267
- package/src/components/JhCard/JhCard.md +0 -246
- package/src/components/JhCheckCard/JhCheckCard.md +0 -245
- package/src/components/JhConfirmDialog/JhConfirmDialog.md +0 -70
- package/src/components/JhDateRangePicker/JhDateRangePicker.md +0 -56
- package/src/components/JhDescriptions/JhDescriptions.md +0 -724
- package/src/components/JhDraggable/JhDraggable.md +0 -66
- package/src/components/JhDrawer/JhDrawer.md +0 -68
- package/src/components/JhDrawerForm/JhDrawerForm.md +0 -69
- package/src/components/JhEditableTable/JhEditableTable.md +0 -507
- package/src/components/JhFileInput/JhFileInput.md +0 -56
- package/src/components/JhForm/JhForm.md +0 -676
- package/src/components/JhFormFields/JhFormFields.md +0 -647
- package/src/components/JhFormList/JhFormList.md +0 -303
- package/src/components/JhJsonEditor/JhJsonEditor.md +0 -54
- package/src/components/JhLayout/JhLayout.md +0 -580
- package/src/components/JhList/JhList.md +0 -441
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +0 -56
- package/src/components/JhMask/JhMask.md +0 -62
- package/src/components/JhMenu/JhMenu.md +0 -85
- package/src/components/JhModal/JhModal.md +0 -68
- package/src/components/JhModalForm/JhModalForm.md +0 -69
- package/src/components/JhPageContainer/JhPageContainer.md +0 -409
- package/src/components/JhQueryFilter/JhQueryFilter.md +0 -77
- package/src/components/JhScene/JhScene.md +0 -64
- package/src/components/JhStatisticCard/JhStatisticCard.md +0 -363
- package/src/components/JhStepsForm/JhStepsForm.md +0 -666
- package/src/components/JhTable/JhTable.md +0 -730
- package/src/components/JhTableAttachment/JhTableAttachment.md +0 -70
- package/src/components/JhToast/JhToast.md +0 -67
- package/src/components/JhTreeSelect/JhTreeSelect.md +0 -82
- package/src/components/JhWaterMark/JhWaterMark.md +0 -190
- package/src/components/README.md +0 -52
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
# JhStatisticCard 指标卡
|
|
2
|
-
|
|
3
|
-
指标卡组件,参考 Ant Design Pro StatisticCard 设计规范。用于展示统计数据、趋势和图表,适用于数据大屏、仪表盘等场景。
|
|
4
|
-
|
|
5
|
-
## 依赖安装
|
|
6
|
-
|
|
7
|
-
### 方式一:CDN 引入(推荐)
|
|
8
|
-
|
|
9
|
-
在 HTML 文件中添加 ECharts CDN 链接:
|
|
10
|
-
|
|
11
|
-
```html
|
|
12
|
-
<!-- 在 head 标签中添加 -->
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**优势**:无需安装 npm 依赖,避免版本冲突,减少打包体积。
|
|
17
|
-
|
|
18
|
-
### 方式二:NPM 安装
|
|
19
|
-
|
|
20
|
-
如果更喜欢 npm 方式:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
# Vue 2 项目请安装以下版本
|
|
24
|
-
npm install echarts@5 vue-echarts@6 --save
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## 何时使用
|
|
28
|
-
|
|
29
|
-
- 需要展示统计数据和趋势时
|
|
30
|
-
- 构建数据大屏或仪表盘时
|
|
31
|
-
- 需要可视化关键业务指标时
|
|
32
|
-
- 需要对比多个指标数据时
|
|
33
|
-
|
|
34
|
-
## 基础用法
|
|
35
|
-
|
|
36
|
-
```vue
|
|
37
|
-
<template>
|
|
38
|
-
<jh-statistic-card
|
|
39
|
-
title="总销售额"
|
|
40
|
-
:value="126560"
|
|
41
|
-
prefix="¥"
|
|
42
|
-
trend="12.5%"
|
|
43
|
-
trend-type="up"
|
|
44
|
-
description="周同比"
|
|
45
|
-
/>
|
|
46
|
-
</template>
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## 带图表
|
|
50
|
-
|
|
51
|
-
```vue
|
|
52
|
-
<template>
|
|
53
|
-
<jh-statistic-card
|
|
54
|
-
title="访问量"
|
|
55
|
-
:value="8846"
|
|
56
|
-
trend="8.5%"
|
|
57
|
-
trend-type="up"
|
|
58
|
-
description="日同比"
|
|
59
|
-
:chart-option="chartOption"
|
|
60
|
-
:chart-width="120"
|
|
61
|
-
:chart-height="46"
|
|
62
|
-
/>
|
|
63
|
-
</template>
|
|
64
|
-
|
|
65
|
-
<script>
|
|
66
|
-
export default {
|
|
67
|
-
data() {
|
|
68
|
-
return {
|
|
69
|
-
chartOption: {
|
|
70
|
-
grid: {
|
|
71
|
-
left: 0,
|
|
72
|
-
right: 0,
|
|
73
|
-
top: 0,
|
|
74
|
-
bottom: 0,
|
|
75
|
-
},
|
|
76
|
-
xAxis: {
|
|
77
|
-
type: 'category',
|
|
78
|
-
show: false,
|
|
79
|
-
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
80
|
-
},
|
|
81
|
-
yAxis: {
|
|
82
|
-
type: 'value',
|
|
83
|
-
show: false,
|
|
84
|
-
},
|
|
85
|
-
series: [
|
|
86
|
-
{
|
|
87
|
-
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
|
88
|
-
type: 'line',
|
|
89
|
-
smooth: true,
|
|
90
|
-
symbol: 'none',
|
|
91
|
-
lineStyle: {
|
|
92
|
-
color: '#1890ff',
|
|
93
|
-
width: 2,
|
|
94
|
-
},
|
|
95
|
-
areaStyle: {
|
|
96
|
-
color: {
|
|
97
|
-
type: 'linear',
|
|
98
|
-
x: 0,
|
|
99
|
-
y: 0,
|
|
100
|
-
x2: 0,
|
|
101
|
-
y2: 1,
|
|
102
|
-
colorStops: [
|
|
103
|
-
{ offset: 0, color: 'rgba(24, 144, 255, 0.3)' },
|
|
104
|
-
{ offset: 1, color: 'rgba(24, 144, 255, 0)' },
|
|
105
|
-
],
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
</script>
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## 多个指标卡组合
|
|
118
|
-
|
|
119
|
-
```vue
|
|
120
|
-
<template>
|
|
121
|
-
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px;">
|
|
122
|
-
<jh-statistic-card
|
|
123
|
-
title="总销售额"
|
|
124
|
-
:value="126560"
|
|
125
|
-
prefix="¥"
|
|
126
|
-
trend="12.5%"
|
|
127
|
-
trend-type="up"
|
|
128
|
-
description="周同比"
|
|
129
|
-
:chart-option="lineChartOption"
|
|
130
|
-
/>
|
|
131
|
-
<jh-statistic-card
|
|
132
|
-
title="访问量"
|
|
133
|
-
:value="8846"
|
|
134
|
-
trend="8.5%"
|
|
135
|
-
trend-type="up"
|
|
136
|
-
description="日同比"
|
|
137
|
-
:chart-option="lineChartOption"
|
|
138
|
-
/>
|
|
139
|
-
<jh-statistic-card
|
|
140
|
-
title="支付笔数"
|
|
141
|
-
:value="6560"
|
|
142
|
-
trend="5.2%"
|
|
143
|
-
trend-type="down"
|
|
144
|
-
description="周同比"
|
|
145
|
-
:chart-option="barChartOption"
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
</template>
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## API
|
|
152
|
-
|
|
153
|
-
### Props
|
|
154
|
-
|
|
155
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
156
|
-
| --- | --- | --- | --- |
|
|
157
|
-
| title | 卡片标题 | `string` | - |
|
|
158
|
-
| tooltip | 标题提示信息 | `string` | - |
|
|
159
|
-
| value | 统计数值 | `number \| string` | `0` |
|
|
160
|
-
| prefix | 数值前缀 | `string` | - |
|
|
161
|
-
| suffix | 数值后缀 | `string` | - |
|
|
162
|
-
| precision | 数值精度(小数位数) | `number` | `0` |
|
|
163
|
-
| valueColor | 数值颜色 | `string` | - |
|
|
164
|
-
| trend | 趋势文本 | `string` | - |
|
|
165
|
-
| trendType | 趋势类型 | `'up' \| 'down'` | `'up'` |
|
|
166
|
-
| description | 描述信息 | `string` | - |
|
|
167
|
-
| footer | 底部信息 | `string` | - |
|
|
168
|
-
| chartOption | ECharts 图表配置 | `object` | - |
|
|
169
|
-
| chartHeight | 图表高度 | `number \| string` | `46` |
|
|
170
|
-
| chartWidth | 图表宽度 | `number \| string` | `100` |
|
|
171
|
-
| bordered | 是否显示边框 | `boolean` | `true` |
|
|
172
|
-
| loading | 加载状态 | `boolean` | `false` |
|
|
173
|
-
| layout | 布局方向 | `'horizontal' \| 'vertical'` | `'horizontal'` |
|
|
174
|
-
|
|
175
|
-
### Slots
|
|
176
|
-
|
|
177
|
-
| 名称 | 说明 |
|
|
178
|
-
| --- | --- |
|
|
179
|
-
| title | 自定义标题 |
|
|
180
|
-
| value | 自定义数值 |
|
|
181
|
-
| trend | 自定义趋势 |
|
|
182
|
-
| description | 自定义描述 |
|
|
183
|
-
| chart | 自定义图表 |
|
|
184
|
-
| footer | 自定义底部 |
|
|
185
|
-
|
|
186
|
-
## 图表配置示例
|
|
187
|
-
|
|
188
|
-
### 折线图
|
|
189
|
-
|
|
190
|
-
```javascript
|
|
191
|
-
{
|
|
192
|
-
grid: {
|
|
193
|
-
left: 0,
|
|
194
|
-
right: 0,
|
|
195
|
-
top: 0,
|
|
196
|
-
bottom: 0,
|
|
197
|
-
},
|
|
198
|
-
xAxis: {
|
|
199
|
-
type: 'category',
|
|
200
|
-
show: false,
|
|
201
|
-
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
202
|
-
},
|
|
203
|
-
yAxis: {
|
|
204
|
-
type: 'value',
|
|
205
|
-
show: false,
|
|
206
|
-
},
|
|
207
|
-
series: [
|
|
208
|
-
{
|
|
209
|
-
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
|
210
|
-
type: 'line',
|
|
211
|
-
smooth: true,
|
|
212
|
-
symbol: 'none',
|
|
213
|
-
lineStyle: {
|
|
214
|
-
color: '#1890ff',
|
|
215
|
-
width: 2,
|
|
216
|
-
},
|
|
217
|
-
areaStyle: {
|
|
218
|
-
color: {
|
|
219
|
-
type: 'linear',
|
|
220
|
-
x: 0,
|
|
221
|
-
y: 0,
|
|
222
|
-
x2: 0,
|
|
223
|
-
y2: 1,
|
|
224
|
-
colorStops: [
|
|
225
|
-
{ offset: 0, color: 'rgba(24, 144, 255, 0.3)' },
|
|
226
|
-
{ offset: 1, color: 'rgba(24, 144, 255, 0)' },
|
|
227
|
-
],
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
],
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### 柱状图
|
|
236
|
-
|
|
237
|
-
```javascript
|
|
238
|
-
{
|
|
239
|
-
grid: {
|
|
240
|
-
left: 0,
|
|
241
|
-
right: 0,
|
|
242
|
-
top: 0,
|
|
243
|
-
bottom: 0,
|
|
244
|
-
},
|
|
245
|
-
xAxis: {
|
|
246
|
-
type: 'category',
|
|
247
|
-
show: false,
|
|
248
|
-
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
249
|
-
},
|
|
250
|
-
yAxis: {
|
|
251
|
-
type: 'value',
|
|
252
|
-
show: false,
|
|
253
|
-
},
|
|
254
|
-
series: [
|
|
255
|
-
{
|
|
256
|
-
data: [120, 200, 150, 80, 70, 110, 130],
|
|
257
|
-
type: 'bar',
|
|
258
|
-
barWidth: 4,
|
|
259
|
-
itemStyle: {
|
|
260
|
-
color: '#52c41a',
|
|
261
|
-
borderRadius: [2, 2, 0, 0],
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
],
|
|
265
|
-
}
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
## 设计规范
|
|
269
|
-
|
|
270
|
-
### 尺寸规范
|
|
271
|
-
|
|
272
|
-
- **卡片内边距**: 24px
|
|
273
|
-
- **标题字号**: 14px
|
|
274
|
-
- **数值字号**: 30px
|
|
275
|
-
- **趋势字号**: 14px
|
|
276
|
-
- **描述字号**: 14px
|
|
277
|
-
- **图表默认高度**: 46px
|
|
278
|
-
- **图表默认宽度**: 100px
|
|
279
|
-
|
|
280
|
-
### 颜色规范
|
|
281
|
-
|
|
282
|
-
- **标题颜色**: `rgba(0, 0, 0, 0.65)`
|
|
283
|
-
- **数值颜色**: `rgba(0, 0, 0, 0.85)`
|
|
284
|
-
- **描述颜色**: `rgba(0, 0, 0, 0.45)`
|
|
285
|
-
- **上升趋势**: `#52c41a` (绿色)
|
|
286
|
-
- **下降趋势**: `#f5222d` (红色)
|
|
287
|
-
- **边框颜色**: `#e8e8e8`
|
|
288
|
-
|
|
289
|
-
### 布局规范
|
|
290
|
-
|
|
291
|
-
- **水平布局**: 数据在左,图表在右
|
|
292
|
-
- **垂直布局**: 数据在上,图表在下
|
|
293
|
-
- **卡片间距**: 建议 16px
|
|
294
|
-
- **响应式**: 建议使用 Grid 布局,最小宽度 280px
|
|
295
|
-
|
|
296
|
-
## 最佳实践
|
|
297
|
-
|
|
298
|
-
### 1. 数值格式化
|
|
299
|
-
|
|
300
|
-
```vue
|
|
301
|
-
<jh-statistic-card
|
|
302
|
-
title="销售额"
|
|
303
|
-
:value="126560.123"
|
|
304
|
-
:precision="2"
|
|
305
|
-
prefix="¥"
|
|
306
|
-
/>
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### 2. 趋势展示
|
|
310
|
-
|
|
311
|
-
```vue
|
|
312
|
-
<jh-statistic-card
|
|
313
|
-
title="访问量"
|
|
314
|
-
:value="8846"
|
|
315
|
-
trend="8.5%"
|
|
316
|
-
trend-type="up"
|
|
317
|
-
description="日同比"
|
|
318
|
-
/>
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
### 3. 自定义颜色
|
|
322
|
-
|
|
323
|
-
```vue
|
|
324
|
-
<jh-statistic-card
|
|
325
|
-
title="异常订单"
|
|
326
|
-
:value="234"
|
|
327
|
-
value-color="#f5222d"
|
|
328
|
-
trend="15.3%"
|
|
329
|
-
trend-type="down"
|
|
330
|
-
/>
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
### 4. 响应式布局
|
|
334
|
-
|
|
335
|
-
```vue
|
|
336
|
-
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px;">
|
|
337
|
-
<jh-statistic-card ... />
|
|
338
|
-
<jh-statistic-card ... />
|
|
339
|
-
<jh-statistic-card ... />
|
|
340
|
-
</div>
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
### 5. 图表优化
|
|
344
|
-
|
|
345
|
-
- 使用 `grid` 配置去除图表边距
|
|
346
|
-
- 隐藏坐标轴 (`show: false`)
|
|
347
|
-
- 使用 `smooth: true` 使折线更平滑
|
|
348
|
-
- 使用 `symbol: 'none'` 隐藏数据点
|
|
349
|
-
- 使用渐变色增强视觉效果
|
|
350
|
-
|
|
351
|
-
## 注意事项
|
|
352
|
-
|
|
353
|
-
1. **依赖安装**: 使用前必须安装 `echarts@5` 和 `vue-echarts@6`
|
|
354
|
-
2. **性能优化**: 大量图表时建议使用懒加载或虚拟滚动
|
|
355
|
-
3. **数据更新**: 图表数据更新时会自动重新渲染
|
|
356
|
-
4. **响应式**: 图表会自动适应容器大小变化
|
|
357
|
-
5. **主题定制**: 可以通过 ECharts 主题定制图表样式
|
|
358
|
-
|
|
359
|
-
## 参考资料
|
|
360
|
-
|
|
361
|
-
- [Ant Design Pro StatisticCard](https://procomponents.ant.design/components/statistic-card)
|
|
362
|
-
- [ECharts 文档](https://echarts.apache.org/zh/index.html)
|
|
363
|
-
- [vue-echarts 文档](https://github.com/ecomfe/vue-echarts)
|