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,604 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="cardClasses"
|
|
4
|
+
:style="cardStyles"
|
|
5
|
+
>
|
|
6
|
+
<!-- 标题栏 -->
|
|
7
|
+
<div
|
|
8
|
+
v-if="hasHeader"
|
|
9
|
+
:class="headerClasses"
|
|
10
|
+
>
|
|
11
|
+
<div class="jh-card-header-left">
|
|
12
|
+
<!-- 标题 -->
|
|
13
|
+
<div v-if="title" class="jh-card-title">
|
|
14
|
+
{{ title }}
|
|
15
|
+
</div>
|
|
16
|
+
<!-- 标题插槽 -->
|
|
17
|
+
<slot name="title"></slot>
|
|
18
|
+
|
|
19
|
+
<!-- Tooltip 提示 -->
|
|
20
|
+
<v-tooltip v-if="tooltip" bottom>
|
|
21
|
+
<template v-slot:activator="{ on, attrs }">
|
|
22
|
+
<v-icon
|
|
23
|
+
small
|
|
24
|
+
class="ml-2"
|
|
25
|
+
v-bind="attrs"
|
|
26
|
+
v-on="on"
|
|
27
|
+
>
|
|
28
|
+
mdi-help-circle-outline
|
|
29
|
+
</v-icon>
|
|
30
|
+
</template>
|
|
31
|
+
<span>{{ tooltip }}</span>
|
|
32
|
+
</v-tooltip>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<!-- 右侧额外内容 -->
|
|
36
|
+
<div v-if="extra || $slots.extra" class="jh-card-extra">
|
|
37
|
+
<slot name="extra">{{ extra }}</slot>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- 折叠按钮 -->
|
|
41
|
+
<v-btn
|
|
42
|
+
v-if="collapsible"
|
|
43
|
+
icon
|
|
44
|
+
small
|
|
45
|
+
class="ml-2"
|
|
46
|
+
@click="toggleCollapse"
|
|
47
|
+
>
|
|
48
|
+
<v-icon>{{ isCollapsed ? 'mdi-chevron-down' : 'mdi-chevron-up' }}</v-icon>
|
|
49
|
+
</v-btn>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<!-- 标题分割线 -->
|
|
53
|
+
<v-divider v-if="hasHeader && headerBordered" />
|
|
54
|
+
|
|
55
|
+
<!-- Tabs 标签页 -->
|
|
56
|
+
<v-tabs
|
|
57
|
+
v-if="tabs"
|
|
58
|
+
v-model="activeTabKey"
|
|
59
|
+
:vertical="tabs.tabPosition === 'left' || tabs.tabPosition === 'right'"
|
|
60
|
+
:class="tabsClasses"
|
|
61
|
+
@change="handleTabChange"
|
|
62
|
+
>
|
|
63
|
+
<v-tab
|
|
64
|
+
v-for="tab in tabPanes"
|
|
65
|
+
:key="tab.key"
|
|
66
|
+
>
|
|
67
|
+
{{ tab.tab }}
|
|
68
|
+
</v-tab>
|
|
69
|
+
</v-tabs>
|
|
70
|
+
|
|
71
|
+
<!-- 卡片内容 -->
|
|
72
|
+
<div
|
|
73
|
+
v-show="!isCollapsed"
|
|
74
|
+
:class="bodyClasses"
|
|
75
|
+
:style="bodyStyles"
|
|
76
|
+
>
|
|
77
|
+
<!-- Tabs 内容 -->
|
|
78
|
+
<template v-if="tabs">
|
|
79
|
+
<v-tabs-items v-model="activeTabKey">
|
|
80
|
+
<v-tab-item
|
|
81
|
+
v-for="tab in tabPanes"
|
|
82
|
+
:key="tab.key"
|
|
83
|
+
>
|
|
84
|
+
<slot :name="`tab-${tab.key}`">
|
|
85
|
+
{{ tab.content }}
|
|
86
|
+
</slot>
|
|
87
|
+
</v-tab-item>
|
|
88
|
+
</v-tabs-items>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<!-- 普通内容 -->
|
|
92
|
+
<template v-else>
|
|
93
|
+
<!-- Loading 状态 -->
|
|
94
|
+
<div v-if="loading" class="jh-card-loading">
|
|
95
|
+
<v-progress-circular
|
|
96
|
+
indeterminate
|
|
97
|
+
color="primary"
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<!-- 默认插槽内容 -->
|
|
102
|
+
<slot v-else></slot>
|
|
103
|
+
</template>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<!-- 底部操作区 -->
|
|
107
|
+
<template v-if="actions && actions.length > 0">
|
|
108
|
+
<v-divider />
|
|
109
|
+
<div class="jh-card-actions">
|
|
110
|
+
<div
|
|
111
|
+
v-for="(action, index) in actions"
|
|
112
|
+
:key="index"
|
|
113
|
+
class="jh-card-action-item"
|
|
114
|
+
>
|
|
115
|
+
<component
|
|
116
|
+
:is="action.component || 'div'"
|
|
117
|
+
v-bind="action.props"
|
|
118
|
+
@click="action.onClick"
|
|
119
|
+
>
|
|
120
|
+
<v-icon v-if="action.icon">{{ action.icon }}</v-icon>
|
|
121
|
+
<span v-if="action.text">{{ action.text }}</span>
|
|
122
|
+
</component>
|
|
123
|
+
<v-divider
|
|
124
|
+
v-if="index < actions.length - 1"
|
|
125
|
+
vertical
|
|
126
|
+
class="mx-2"
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</template>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<script>
|
|
135
|
+
export default {
|
|
136
|
+
name: 'JhCard',
|
|
137
|
+
|
|
138
|
+
props: {
|
|
139
|
+
// 标题
|
|
140
|
+
title: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: '',
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
// 副标题
|
|
146
|
+
subTitle: {
|
|
147
|
+
type: String,
|
|
148
|
+
default: '',
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
// 提示信息
|
|
152
|
+
tooltip: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: '',
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
// 右上角额外内容
|
|
158
|
+
extra: {
|
|
159
|
+
type: String,
|
|
160
|
+
default: '',
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
// 是否有边框
|
|
164
|
+
bordered: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
default: true,
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
// 标题和内容之间是否有分割线
|
|
170
|
+
headerBordered: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
default: false,
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
// 幽灵模式(无背景和padding)
|
|
176
|
+
ghost: {
|
|
177
|
+
type: Boolean,
|
|
178
|
+
default: false,
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
// 是否可折叠
|
|
182
|
+
collapsible: {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
default: false,
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
// 默认是否折叠
|
|
188
|
+
defaultCollapsed: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
default: false,
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
// 尺寸 small | default
|
|
194
|
+
size: {
|
|
195
|
+
type: String,
|
|
196
|
+
default: 'default',
|
|
197
|
+
validator: (value) => ['small', 'default'].includes(value),
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
// 加载状态
|
|
201
|
+
loading: {
|
|
202
|
+
type: Boolean,
|
|
203
|
+
default: false,
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
// 底部操作按钮
|
|
207
|
+
actions: {
|
|
208
|
+
type: Array,
|
|
209
|
+
default: () => [],
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
// 布局方式 center | default
|
|
213
|
+
layout: {
|
|
214
|
+
type: String,
|
|
215
|
+
default: 'default',
|
|
216
|
+
validator: (value) => ['default', 'center'].includes(value),
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
// Flex 方向 row | column
|
|
220
|
+
direction: {
|
|
221
|
+
type: String,
|
|
222
|
+
default: 'row',
|
|
223
|
+
validator: (value) => ['row', 'column'].includes(value),
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
// 分栏模式 vertical | horizontal
|
|
227
|
+
split: {
|
|
228
|
+
type: String,
|
|
229
|
+
default: '',
|
|
230
|
+
validator: (value) => ['', 'vertical', 'horizontal'].includes(value),
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
// 栅格占比
|
|
234
|
+
colSpan: {
|
|
235
|
+
type: [Number, String],
|
|
236
|
+
default: 24,
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
// 栅格间距
|
|
240
|
+
gutter: {
|
|
241
|
+
type: [Number, Array],
|
|
242
|
+
default: 0,
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
// 标签页配置
|
|
246
|
+
tabs: {
|
|
247
|
+
type: Object,
|
|
248
|
+
default: null,
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
// 悬浮效果
|
|
252
|
+
hoverable: {
|
|
253
|
+
type: Boolean,
|
|
254
|
+
default: false,
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
// 自定义样式
|
|
258
|
+
bodyStyle: {
|
|
259
|
+
type: Object,
|
|
260
|
+
default: () => ({}),
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
// 自定义头部样式
|
|
264
|
+
headStyle: {
|
|
265
|
+
type: Object,
|
|
266
|
+
default: () => ({}),
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
data() {
|
|
271
|
+
return {
|
|
272
|
+
isCollapsed: this.defaultCollapsed,
|
|
273
|
+
activeTabKey: this.tabs?.activeKey || 0,
|
|
274
|
+
tabPanes: [],
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
computed: {
|
|
279
|
+
// 是否有标题栏
|
|
280
|
+
hasHeader() {
|
|
281
|
+
return this.title || this.$slots.title || this.extra || this.$slots.extra || this.collapsible;
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
// 卡片样式类
|
|
285
|
+
cardClasses() {
|
|
286
|
+
return [
|
|
287
|
+
'jh-card',
|
|
288
|
+
{
|
|
289
|
+
'jh-card--bordered': this.bordered,
|
|
290
|
+
'jh-card--ghost': this.ghost,
|
|
291
|
+
'jh-card--small': this.size === 'small',
|
|
292
|
+
'jh-card--hoverable': this.hoverable,
|
|
293
|
+
'jh-card--split-vertical': this.split === 'vertical',
|
|
294
|
+
'jh-card--split-horizontal': this.split === 'horizontal',
|
|
295
|
+
'jh-card--layout-center': this.layout === 'center',
|
|
296
|
+
},
|
|
297
|
+
];
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
// 卡片样式
|
|
301
|
+
cardStyles() {
|
|
302
|
+
const styles = {};
|
|
303
|
+
|
|
304
|
+
// 处理 colSpan
|
|
305
|
+
if (this.colSpan !== 24) {
|
|
306
|
+
if (typeof this.colSpan === 'number') {
|
|
307
|
+
styles.flex = `0 0 ${(this.colSpan / 24) * 100}%`;
|
|
308
|
+
styles.maxWidth = `${(this.colSpan / 24) * 100}%`;
|
|
309
|
+
} else if (typeof this.colSpan === 'string') {
|
|
310
|
+
if (this.colSpan.endsWith('%')) {
|
|
311
|
+
styles.flex = `0 0 ${this.colSpan}`;
|
|
312
|
+
styles.maxWidth = this.colSpan;
|
|
313
|
+
} else if (this.colSpan.endsWith('px')) {
|
|
314
|
+
styles.flex = `0 0 ${this.colSpan}`;
|
|
315
|
+
styles.maxWidth = this.colSpan;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// 处理 gutter
|
|
321
|
+
if (this.gutter) {
|
|
322
|
+
if (Array.isArray(this.gutter)) {
|
|
323
|
+
const [horizontal, vertical] = this.gutter;
|
|
324
|
+
if (horizontal) styles.marginLeft = `${horizontal / 2}px`;
|
|
325
|
+
if (horizontal) styles.marginRight = `${horizontal / 2}px`;
|
|
326
|
+
if (vertical) styles.marginTop = `${vertical / 2}px`;
|
|
327
|
+
if (vertical) styles.marginBottom = `${vertical / 2}px`;
|
|
328
|
+
} else {
|
|
329
|
+
styles.gap = `${this.gutter}px`;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Flex 方向
|
|
334
|
+
// if (this.direction) {
|
|
335
|
+
// styles.flexDirection = this.direction;
|
|
336
|
+
// }
|
|
337
|
+
|
|
338
|
+
return styles;
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
// 标题栏样式类
|
|
342
|
+
headerClasses() {
|
|
343
|
+
return [
|
|
344
|
+
'jh-card-header',
|
|
345
|
+
{
|
|
346
|
+
'jh-card-header--small': this.size === 'small',
|
|
347
|
+
},
|
|
348
|
+
];
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
// 内容区样式类
|
|
352
|
+
bodyClasses() {
|
|
353
|
+
return [
|
|
354
|
+
'jh-card-body',
|
|
355
|
+
{
|
|
356
|
+
'jh-card-body--small': this.size === 'small',
|
|
357
|
+
'jh-card-body--ghost': this.ghost,
|
|
358
|
+
'jh-card-body--center': this.layout === 'center',
|
|
359
|
+
},
|
|
360
|
+
];
|
|
361
|
+
},
|
|
362
|
+
|
|
363
|
+
// 内容区样式
|
|
364
|
+
bodyStyles() {
|
|
365
|
+
return {
|
|
366
|
+
...this.bodyStyle,
|
|
367
|
+
flexDirection: this.direction,
|
|
368
|
+
};
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
// Tabs 样式类
|
|
372
|
+
tabsClasses() {
|
|
373
|
+
return [
|
|
374
|
+
'jh-card-tabs',
|
|
375
|
+
{
|
|
376
|
+
'jh-card-tabs--card': this.tabs?.type === 'card',
|
|
377
|
+
},
|
|
378
|
+
];
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
|
|
382
|
+
watch: {
|
|
383
|
+
'tabs.activeKey'(val) {
|
|
384
|
+
this.activeTabKey = val;
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
mounted() {
|
|
389
|
+
// 收集 TabPane 子组件
|
|
390
|
+
if (this.tabs && this.$slots.default) {
|
|
391
|
+
this.collectTabPanes();
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
|
|
395
|
+
methods: {
|
|
396
|
+
// 切换折叠状态
|
|
397
|
+
toggleCollapse() {
|
|
398
|
+
this.isCollapsed = !this.isCollapsed;
|
|
399
|
+
this.$emit('collapse', this.isCollapsed);
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
// 处理标签页切换
|
|
403
|
+
handleTabChange(key) {
|
|
404
|
+
this.activeTabKey = key;
|
|
405
|
+
this.$emit('tab-change', key);
|
|
406
|
+
if (this.tabs?.onChange) {
|
|
407
|
+
this.tabs.onChange(key);
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
|
|
411
|
+
// 收集 TabPane
|
|
412
|
+
collectTabPanes() {
|
|
413
|
+
const panes = [];
|
|
414
|
+
const slots = this.$slots.default || [];
|
|
415
|
+
|
|
416
|
+
slots.forEach((vnode, index) => {
|
|
417
|
+
if (vnode.componentOptions && vnode.componentOptions.tag === 'jh-card-tab-pane') {
|
|
418
|
+
const props = vnode.componentOptions.propsData || {};
|
|
419
|
+
panes.push({
|
|
420
|
+
key: props.tabKey || index,
|
|
421
|
+
tab: props.tab || `Tab ${index + 1}`,
|
|
422
|
+
content: vnode,
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
this.tabPanes = panes;
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
};
|
|
431
|
+
</script>
|
|
432
|
+
|
|
433
|
+
<style scoped>
|
|
434
|
+
/* 卡片容器 */
|
|
435
|
+
.jh-card {
|
|
436
|
+
display: flex;
|
|
437
|
+
flex-direction: column;
|
|
438
|
+
background: #ffffff;
|
|
439
|
+
border-radius: 4px;
|
|
440
|
+
transition: box-shadow 0.3s;
|
|
441
|
+
position: relative;
|
|
442
|
+
width: 100%;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/* 边框 */
|
|
446
|
+
.jh-card--bordered {
|
|
447
|
+
border: 1px solid #e8e8e8;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/* 幽灵模式 */
|
|
451
|
+
.jh-card--ghost {
|
|
452
|
+
background: transparent;
|
|
453
|
+
border: none;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/* 悬浮效果 */
|
|
457
|
+
.jh-card--hoverable:hover {
|
|
458
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
|
|
459
|
+
cursor: pointer;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/* 分栏模式 */
|
|
463
|
+
.jh-card--split-vertical,
|
|
464
|
+
.jh-card--split-horizontal {
|
|
465
|
+
display: flex;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.jh-card--split-vertical {
|
|
469
|
+
flex-direction: row;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.jh-card--split-horizontal {
|
|
473
|
+
flex-direction: column;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.jh-card--split-vertical > .jh-card,
|
|
477
|
+
.jh-card--split-horizontal > .jh-card {
|
|
478
|
+
border-radius: 0;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.jh-card--split-vertical > .jh-card:not(:last-child) {
|
|
482
|
+
border-right: 1px solid #e8e8e8;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.jh-card--split-horizontal > .jh-card:not(:last-child) {
|
|
486
|
+
border-bottom: 1px solid #e8e8e8;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/* 居中布局 */
|
|
490
|
+
.jh-card--layout-center {
|
|
491
|
+
display: flex;
|
|
492
|
+
justify-content: center;
|
|
493
|
+
align-items: center;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/* 标题栏 */
|
|
497
|
+
.jh-card-header {
|
|
498
|
+
display: flex;
|
|
499
|
+
align-items: center;
|
|
500
|
+
justify-content: space-between;
|
|
501
|
+
padding: 16px 24px;
|
|
502
|
+
min-height: 56px;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.jh-card-header--small {
|
|
506
|
+
padding: 12px 16px;
|
|
507
|
+
min-height: 48px;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.jh-card-header-left {
|
|
511
|
+
display: flex;
|
|
512
|
+
align-items: center;
|
|
513
|
+
flex: 1;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.jh-card-title {
|
|
517
|
+
font-size: 16px;
|
|
518
|
+
font-weight: 500;
|
|
519
|
+
color: rgba(0, 0, 0, 0.85);
|
|
520
|
+
line-height: 1.5;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.jh-card-extra {
|
|
524
|
+
color: rgba(0, 0, 0, 0.65);
|
|
525
|
+
font-size: 14px;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/* 内容区 */
|
|
529
|
+
.jh-card-body {
|
|
530
|
+
padding: 24px;
|
|
531
|
+
flex: 1;
|
|
532
|
+
display: flex;
|
|
533
|
+
flex-direction: column;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.jh-card-body--small {
|
|
537
|
+
padding: 16px;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.jh-card-body--ghost {
|
|
541
|
+
padding: 0;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.jh-card-body--center {
|
|
545
|
+
justify-content: center;
|
|
546
|
+
align-items: center;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/* 加载状态 */
|
|
550
|
+
.jh-card-loading {
|
|
551
|
+
display: flex;
|
|
552
|
+
justify-content: center;
|
|
553
|
+
align-items: center;
|
|
554
|
+
min-height: 100px;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/* 操作区 */
|
|
558
|
+
.jh-card-actions {
|
|
559
|
+
display: flex;
|
|
560
|
+
align-items: center;
|
|
561
|
+
justify-content: space-around;
|
|
562
|
+
padding: 12px 0;
|
|
563
|
+
background: #fafafa;
|
|
564
|
+
border-top: 1px solid #e8e8e8;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.jh-card-action-item {
|
|
568
|
+
display: flex;
|
|
569
|
+
align-items: center;
|
|
570
|
+
color: rgba(0, 0, 0, 0.65);
|
|
571
|
+
cursor: pointer;
|
|
572
|
+
transition: color 0.3s;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.jh-card-action-item:hover {
|
|
576
|
+
color: #1890ff;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/* Tabs */
|
|
580
|
+
.jh-card-tabs {
|
|
581
|
+
border-bottom: 1px solid #e8e8e8;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.jh-card-tabs--card .v-tab {
|
|
585
|
+
border: 1px solid #e8e8e8;
|
|
586
|
+
border-bottom: none;
|
|
587
|
+
background: #fafafa;
|
|
588
|
+
margin-right: 2px;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.jh-card-tabs--card .v-tab--active {
|
|
592
|
+
background: #ffffff;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/* 小尺寸 */
|
|
596
|
+
.jh-card--small .jh-card-title {
|
|
597
|
+
font-size: 14px;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/* Divider */
|
|
601
|
+
.jh-card-divider {
|
|
602
|
+
margin: 0;
|
|
603
|
+
}
|
|
604
|
+
</style>
|