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,476 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="cardClasses"
|
|
4
|
+
:style="cardStyles"
|
|
5
|
+
@click="handleClick"
|
|
6
|
+
>
|
|
7
|
+
<!-- 选择指示器 -->
|
|
8
|
+
<div v-if="!hideCheckbox" class="jh-check-card-checkbox">
|
|
9
|
+
<v-icon
|
|
10
|
+
:color="isChecked ? 'primary' : 'grey'"
|
|
11
|
+
:size="checkboxSize"
|
|
12
|
+
>
|
|
13
|
+
{{ isChecked ? 'mdi-checkbox-marked' : 'mdi-checkbox-blank-outline' }}
|
|
14
|
+
</v-icon>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<!-- 卡片内容 -->
|
|
18
|
+
<div class="jh-check-card-content">
|
|
19
|
+
<!-- 头部内容 -->
|
|
20
|
+
<div v-if="hasHeader" class="jh-check-card-header">
|
|
21
|
+
<!-- 标题 -->
|
|
22
|
+
<div v-if="title" class="jh-check-card-title">
|
|
23
|
+
{{ title }}
|
|
24
|
+
</div>
|
|
25
|
+
<!-- 标题插槽 -->
|
|
26
|
+
<slot name="title"></slot>
|
|
27
|
+
|
|
28
|
+
<!-- 描述 -->
|
|
29
|
+
<div v-if="description" class="jh-check-card-description">
|
|
30
|
+
{{ description }}
|
|
31
|
+
</div>
|
|
32
|
+
<!-- 描述插槽 -->
|
|
33
|
+
<slot name="description"></slot>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<!-- 主体内容 -->
|
|
37
|
+
<div class="jh-check-card-body">
|
|
38
|
+
<!-- 封面图片 -->
|
|
39
|
+
<div v-if="cover" class="jh-check-card-cover">
|
|
40
|
+
<img :src="cover" :alt="title || 'cover'" />
|
|
41
|
+
</div>
|
|
42
|
+
<!-- 封面插槽 -->
|
|
43
|
+
<slot name="cover"></slot>
|
|
44
|
+
|
|
45
|
+
<!-- 默认插槽内容 -->
|
|
46
|
+
<slot></slot>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<!-- 底部额外内容 -->
|
|
50
|
+
<div v-if="extra || $slots.extra" class="jh-check-card-extra">
|
|
51
|
+
<slot name="extra">{{ extra }}</slot>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<!-- 加载遮罩 -->
|
|
56
|
+
<div v-if="loading" class="jh-check-card-loading">
|
|
57
|
+
<v-progress-circular
|
|
58
|
+
indeterminate
|
|
59
|
+
color="primary"
|
|
60
|
+
size="24"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<!-- 禁用遮罩 -->
|
|
65
|
+
<div v-if="disabled" class="jh-check-card-disabled-mask"></div>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script>
|
|
70
|
+
export default {
|
|
71
|
+
name: 'JhCheckCard',
|
|
72
|
+
|
|
73
|
+
props: {
|
|
74
|
+
// 卡片标题
|
|
75
|
+
title: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '',
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
// 卡片描述
|
|
81
|
+
description: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: '',
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
// 卡片封面图片
|
|
87
|
+
cover: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: '',
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
// 右下角额外内容
|
|
93
|
+
extra: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: '',
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// 卡片值,用于多选时的标识
|
|
99
|
+
value: {
|
|
100
|
+
type: [String, Number, Boolean],
|
|
101
|
+
default: null,
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// 是否选中
|
|
105
|
+
checked: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false,
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
// 默认选中状态
|
|
111
|
+
defaultChecked: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false,
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
// 是否禁用
|
|
117
|
+
disabled: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: false,
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
// 是否加载中
|
|
123
|
+
loading: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: false,
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
// 卡片尺寸 small | default | large
|
|
129
|
+
size: {
|
|
130
|
+
type: String,
|
|
131
|
+
default: 'default',
|
|
132
|
+
validator: (value) => ['small', 'default', 'large'].includes(value),
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
// 是否显示边框
|
|
136
|
+
bordered: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: true,
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
// 是否隐藏选择框
|
|
142
|
+
hideCheckbox: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
default: false,
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
// 选择框位置 top-left | top-right | bottom-left | bottom-right
|
|
148
|
+
checkboxPosition: {
|
|
149
|
+
type: String,
|
|
150
|
+
default: 'top-right',
|
|
151
|
+
validator: (value) => ['top-left', 'top-right', 'bottom-left', 'bottom-right'].includes(value),
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
// 是否可悬浮
|
|
155
|
+
hoverable: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: true,
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
// 自定义样式
|
|
161
|
+
bodyStyle: {
|
|
162
|
+
type: Object,
|
|
163
|
+
default: () => ({}),
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
// 自定义头部样式
|
|
167
|
+
headStyle: {
|
|
168
|
+
type: Object,
|
|
169
|
+
default: () => ({}),
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
// 卡片宽度
|
|
173
|
+
width: {
|
|
174
|
+
type: [String, Number],
|
|
175
|
+
default: '',
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
// 卡片高度
|
|
179
|
+
height: {
|
|
180
|
+
type: [String, Number],
|
|
181
|
+
default: '',
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
data() {
|
|
186
|
+
return {
|
|
187
|
+
internalChecked: this.checked || this.defaultChecked,
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
computed: {
|
|
192
|
+
// 是否选中
|
|
193
|
+
isChecked() {
|
|
194
|
+
return this.checked !== undefined ? this.checked : this.internalChecked;
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
// 是否有头部
|
|
198
|
+
hasHeader() {
|
|
199
|
+
return this.title || this.$slots.title || this.description || this.$slots.description;
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
// 卡片样式类
|
|
203
|
+
cardClasses() {
|
|
204
|
+
return [
|
|
205
|
+
'jh-check-card',
|
|
206
|
+
`jh-check-card--${this.size}`,
|
|
207
|
+
`jh-check-card--checkbox-${this.checkboxPosition}`,
|
|
208
|
+
{
|
|
209
|
+
'jh-check-card--bordered': this.bordered,
|
|
210
|
+
'jh-check-card--checked': this.isChecked,
|
|
211
|
+
'jh-check-card--disabled': this.disabled,
|
|
212
|
+
'jh-check-card--loading': this.loading,
|
|
213
|
+
'jh-check-card--hoverable': this.hoverable && !this.disabled,
|
|
214
|
+
},
|
|
215
|
+
];
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
// 卡片样式
|
|
219
|
+
cardStyles() {
|
|
220
|
+
const styles = { ...this.bodyStyle };
|
|
221
|
+
|
|
222
|
+
if (this.width) {
|
|
223
|
+
styles.width = typeof this.width === 'number' ? `${this.width}px` : this.width;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (this.height) {
|
|
227
|
+
styles.height = typeof this.height === 'number' ? `${this.height}px` : this.height;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return styles;
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
// 选择框尺寸
|
|
234
|
+
checkboxSize() {
|
|
235
|
+
const sizeMap = {
|
|
236
|
+
small: 16,
|
|
237
|
+
default: 18,
|
|
238
|
+
large: 20,
|
|
239
|
+
};
|
|
240
|
+
return sizeMap[this.size];
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
watch: {
|
|
245
|
+
checked(val) {
|
|
246
|
+
this.internalChecked = val;
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
methods: {
|
|
251
|
+
// 处理点击事件
|
|
252
|
+
handleClick(event) {
|
|
253
|
+
if (this.disabled || this.loading) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// 如果 checked 是受控的,不改变内部状态
|
|
258
|
+
if (this.checked === undefined) {
|
|
259
|
+
this.internalChecked = !this.internalChecked;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// 触发事件
|
|
263
|
+
this.$emit('click', event);
|
|
264
|
+
this.$emit('change', !this.isChecked, this.value);
|
|
265
|
+
|
|
266
|
+
// 兼容 v-model
|
|
267
|
+
this.$emit('input', !this.isChecked);
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
</script>
|
|
272
|
+
|
|
273
|
+
<style scoped>
|
|
274
|
+
/* 卡片容器 */
|
|
275
|
+
.jh-check-card {
|
|
276
|
+
position: relative;
|
|
277
|
+
display: flex;
|
|
278
|
+
flex-direction: column;
|
|
279
|
+
background: #ffffff;
|
|
280
|
+
border-radius: 6px;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
283
|
+
overflow: hidden;
|
|
284
|
+
user-select: none;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* 边框 */
|
|
288
|
+
.jh-check-card--bordered {
|
|
289
|
+
border: 1px solid #d9d9d9;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* 选中状态 */
|
|
293
|
+
.jh-check-card--checked {
|
|
294
|
+
border-color: #1890ff;
|
|
295
|
+
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* 禁用状态 */
|
|
299
|
+
.jh-check-card--disabled {
|
|
300
|
+
cursor: not-allowed;
|
|
301
|
+
opacity: 0.5;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.jh-check-card--disabled .jh-check-card-content {
|
|
305
|
+
pointer-events: none;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/* 加载状态 */
|
|
309
|
+
.jh-check-card--loading {
|
|
310
|
+
cursor: default;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/* 悬浮效果 */
|
|
314
|
+
.jh-check-card--hoverable:hover:not(.jh-check-card--disabled):not(.jh-check-card--loading) {
|
|
315
|
+
border-color: #1890ff;
|
|
316
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* 尺寸变体 */
|
|
320
|
+
.jh-check-card--small {
|
|
321
|
+
min-height: 80px;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.jh-check-card--default {
|
|
325
|
+
min-height: 100px;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.jh-check-card--large {
|
|
329
|
+
min-height: 120px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/* 选择框 */
|
|
333
|
+
.jh-check-card-checkbox {
|
|
334
|
+
position: absolute;
|
|
335
|
+
z-index: 2;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.jh-check-card--checkbox-top-left .jh-check-card-checkbox {
|
|
339
|
+
top: 8px;
|
|
340
|
+
left: 8px;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.jh-check-card--checkbox-top-right .jh-check-card-checkbox {
|
|
344
|
+
top: 8px;
|
|
345
|
+
right: 8px;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.jh-check-card--checkbox-bottom-left .jh-check-card-checkbox {
|
|
349
|
+
bottom: 8px;
|
|
350
|
+
left: 8px;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.jh-check-card--checkbox-bottom-right .jh-check-card-checkbox {
|
|
354
|
+
bottom: 8px;
|
|
355
|
+
right: 8px;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/* 卡片内容 */
|
|
359
|
+
.jh-check-card-content {
|
|
360
|
+
flex: 1;
|
|
361
|
+
display: flex;
|
|
362
|
+
flex-direction: column;
|
|
363
|
+
padding: 16px;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.jh-check-card--small .jh-check-card-content {
|
|
367
|
+
padding: 12px;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.jh-check-card--large .jh-check-card-content {
|
|
371
|
+
padding: 20px;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/* 头部 */
|
|
375
|
+
.jh-check-card-header {
|
|
376
|
+
margin-bottom: 8px;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.jh-check-card-title {
|
|
380
|
+
font-size: 16px;
|
|
381
|
+
font-weight: 500;
|
|
382
|
+
color: rgba(0, 0, 0, 0.85);
|
|
383
|
+
line-height: 1.5;
|
|
384
|
+
margin-bottom: 4px;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.jh-check-card--small .jh-check-card-title {
|
|
388
|
+
font-size: 14px;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.jh-check-card--large .jh-check-card-title {
|
|
392
|
+
font-size: 18px;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.jh-check-card-description {
|
|
396
|
+
font-size: 14px;
|
|
397
|
+
color: rgba(0, 0, 0, 0.65);
|
|
398
|
+
line-height: 1.5;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.jh-check-card--small .jh-check-card-description {
|
|
402
|
+
font-size: 12px;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.jh-check-card--large .jh-check-card-description {
|
|
406
|
+
font-size: 14px;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/* 主体内容 */
|
|
410
|
+
.jh-check-card-body {
|
|
411
|
+
flex: 1;
|
|
412
|
+
display: flex;
|
|
413
|
+
flex-direction: column;
|
|
414
|
+
justify-content: center;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/* 封面图片 */
|
|
418
|
+
.jh-check-card-cover {
|
|
419
|
+
margin-bottom: 12px;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.jh-check-card-cover img {
|
|
423
|
+
width: 100%;
|
|
424
|
+
height: auto;
|
|
425
|
+
border-radius: 4px;
|
|
426
|
+
object-fit: cover;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/* 额外内容 */
|
|
430
|
+
.jh-check-card-extra {
|
|
431
|
+
margin-top: 8px;
|
|
432
|
+
font-size: 12px;
|
|
433
|
+
color: rgba(0, 0, 0, 0.45);
|
|
434
|
+
text-align: right;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/* 加载遮罩 */
|
|
438
|
+
.jh-check-card-loading {
|
|
439
|
+
position: absolute;
|
|
440
|
+
top: 0;
|
|
441
|
+
left: 0;
|
|
442
|
+
right: 0;
|
|
443
|
+
bottom: 0;
|
|
444
|
+
display: flex;
|
|
445
|
+
align-items: center;
|
|
446
|
+
justify-content: center;
|
|
447
|
+
background: rgba(255, 255, 255, 0.8);
|
|
448
|
+
z-index: 10;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/* 禁用遮罩 */
|
|
452
|
+
.jh-check-card-disabled-mask {
|
|
453
|
+
position: absolute;
|
|
454
|
+
top: 0;
|
|
455
|
+
left: 0;
|
|
456
|
+
right: 0;
|
|
457
|
+
bottom: 0;
|
|
458
|
+
background: rgba(255, 255, 255, 0.5);
|
|
459
|
+
z-index: 5;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/* 响应式 */
|
|
463
|
+
@media (max-width: 768px) {
|
|
464
|
+
.jh-check-card-content {
|
|
465
|
+
padding: 12px;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.jh-check-card-title {
|
|
469
|
+
font-size: 14px;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.jh-check-card-description {
|
|
473
|
+
font-size: 12px;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# JhConfirmDialog - 确认对话框组件
|
|
2
|
+
|
|
3
|
+
JhConfirmDialog 基于 Vuetify `v-dialog` 实现,提供统一的确认/取消交互体验,支持异步校验、loading 状态和完全自定义内容,适用于删除、提交、状态切换等需要最终确认的场景。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- ✅ **标题与内容自定义**:支持传入纯文本、HTML 或通过插槽渲染自定义结构
|
|
8
|
+
- ✅ **确认/取消按钮可配置**:文字、颜色、显隐均可通过 props 控制
|
|
9
|
+
- ✅ **异步拦截**:`beforeConfirm`、`beforeCancel` 支持返回 `false` 阻断关闭,方便做表单校验
|
|
10
|
+
- ✅ **loading 态**:配合 `loading` 属性即可在确认阶段展示加载动画
|
|
11
|
+
- ✅ **行为事件齐全**:支持 confirm/cancel/click-outside 等事件,方便接入埋点
|
|
12
|
+
|
|
13
|
+
## 基础用法
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<jh-confirm-dialog
|
|
18
|
+
v-model="visible"
|
|
19
|
+
title="删除确认"
|
|
20
|
+
content="确定要删除这条记录吗?此操作不可恢复。"
|
|
21
|
+
:before-confirm="handleBeforeConfirm"
|
|
22
|
+
:loading="submitting"
|
|
23
|
+
@confirm="handleConfirm"
|
|
24
|
+
@cancel="handleCancel"
|
|
25
|
+
/>
|
|
26
|
+
</template>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
### Props
|
|
32
|
+
|
|
33
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
34
|
+
| --- | --- | --- | --- |
|
|
35
|
+
| value | v-model,控制对话框显示 | boolean | false |
|
|
36
|
+
| title | 标题文本 | string | `提示` |
|
|
37
|
+
| content | 内容文本(可包含 HTML) | string | `''` |
|
|
38
|
+
| contentClass | 内容区域 class | string | `pa-6 text-pre-line` |
|
|
39
|
+
| maxWidth | 最大宽度 | number \| string | 420 |
|
|
40
|
+
| showCancelButton | 是否展示取消按钮 | boolean | true |
|
|
41
|
+
| confirmButtonText | 确认按钮文案 | string | `确定` |
|
|
42
|
+
| cancelButtonText | 取消按钮文案 | string | `取消` |
|
|
43
|
+
| confirmButtonColor | 确认按钮颜色 | string | `primary` |
|
|
44
|
+
| cancelButtonColor | 取消按钮颜色 | string | `default` |
|
|
45
|
+
| persistent | 是否禁止点击遮罩关闭 | boolean | false |
|
|
46
|
+
| loading | 确认按钮 loading 状态 | boolean | false |
|
|
47
|
+
| beforeConfirm | 确认前钩子,返回 false 阻断关闭 | Function | null |
|
|
48
|
+
| beforeCancel | 取消前钩子,返回 false 阻断关闭 | Function | null |
|
|
49
|
+
|
|
50
|
+
### Events
|
|
51
|
+
|
|
52
|
+
| 事件名 | 说明 | 回调参数 |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| input | `v-model` 双向绑定事件 | (visible: boolean) |
|
|
55
|
+
| confirm | 点击确认后触发 | - |
|
|
56
|
+
| cancel | 点击取消或遮罩关闭时触发 | - |
|
|
57
|
+
| click-outside | 点击遮罩区域触发 | - |
|
|
58
|
+
|
|
59
|
+
### Slots
|
|
60
|
+
|
|
61
|
+
| 名称 | 说明 |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| title | 自定义标题内容 |
|
|
64
|
+
| default | 自定义内容区域 |
|
|
65
|
+
|
|
66
|
+
## 使用建议
|
|
67
|
+
|
|
68
|
+
- 需要异步确认时让 `beforeConfirm` 返回 `false`,待操作成功后再手动关闭
|
|
69
|
+
- 在危险操作上将 `persistent` 设为 `true`,避免误触关闭
|
|
70
|
+
- 自定义内容时可通过插槽输出复杂表单、列表或高亮提示
|