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,592 @@
|
|
|
1
|
+
import JhModalForm from './JhModalForm.vue';
|
|
2
|
+
|
|
3
|
+
// 示例字段配置
|
|
4
|
+
const sampleFields = [
|
|
5
|
+
{
|
|
6
|
+
key: 'username',
|
|
7
|
+
label: '用户名',
|
|
8
|
+
type: 'text',
|
|
9
|
+
rules: 'require',
|
|
10
|
+
placeholder: '请输入用户名',
|
|
11
|
+
cols: 12,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
key: 'email',
|
|
15
|
+
label: '邮箱',
|
|
16
|
+
type: 'text',
|
|
17
|
+
rules: 'require|email',
|
|
18
|
+
placeholder: '请输入邮箱',
|
|
19
|
+
cols: 12,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: 'phone',
|
|
23
|
+
label: '手机号',
|
|
24
|
+
type: 'text',
|
|
25
|
+
rules: 'phone',
|
|
26
|
+
placeholder: '请输入手机号',
|
|
27
|
+
cols: 12,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
key: 'role',
|
|
31
|
+
label: '角色',
|
|
32
|
+
type: 'select',
|
|
33
|
+
rules: 'require',
|
|
34
|
+
options: [
|
|
35
|
+
{ text: '管理员', value: 'admin' },
|
|
36
|
+
{ text: '普通用户', value: 'user' },
|
|
37
|
+
{ text: '访客', value: 'guest' },
|
|
38
|
+
],
|
|
39
|
+
cols: 12,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
title: '数据录入/JhModalForm - 弹窗表单',
|
|
45
|
+
component: JhModalForm,
|
|
46
|
+
tags: ['autodocs'],
|
|
47
|
+
argTypes: {
|
|
48
|
+
value: {
|
|
49
|
+
control: 'boolean',
|
|
50
|
+
description: '控制弹窗显示/隐藏 (v-model)',
|
|
51
|
+
},
|
|
52
|
+
title: {
|
|
53
|
+
control: 'text',
|
|
54
|
+
description: '弹窗标题',
|
|
55
|
+
},
|
|
56
|
+
width: {
|
|
57
|
+
control: 'number',
|
|
58
|
+
description: '弹窗宽度',
|
|
59
|
+
},
|
|
60
|
+
fullscreen: {
|
|
61
|
+
control: 'boolean',
|
|
62
|
+
description: '是否全屏显示',
|
|
63
|
+
},
|
|
64
|
+
persistent: {
|
|
65
|
+
control: 'boolean',
|
|
66
|
+
description: '是否持久化(点击外部不关闭)',
|
|
67
|
+
},
|
|
68
|
+
closable: {
|
|
69
|
+
control: 'boolean',
|
|
70
|
+
description: '是否显示关闭按钮',
|
|
71
|
+
},
|
|
72
|
+
showConfirmButton: {
|
|
73
|
+
control: 'boolean',
|
|
74
|
+
description: '是否显示确认按钮',
|
|
75
|
+
},
|
|
76
|
+
confirmText: {
|
|
77
|
+
control: 'text',
|
|
78
|
+
description: '确认按钮文本',
|
|
79
|
+
},
|
|
80
|
+
cancelText: {
|
|
81
|
+
control: 'text',
|
|
82
|
+
description: '取消按钮文本',
|
|
83
|
+
},
|
|
84
|
+
validateBeforeConfirm: {
|
|
85
|
+
control: 'boolean',
|
|
86
|
+
description: '确认前是否验证表单',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
parameters: {
|
|
90
|
+
docs: {
|
|
91
|
+
description: {
|
|
92
|
+
component: `
|
|
93
|
+
|
|
94
|
+
弹窗表单组件,支持 JSON 配置和自定义内容。基于 JhDrawerFormBasic 的设计模式重写,移除了 JhProForm 依赖。
|
|
95
|
+
|
|
96
|
+
## 功能特性
|
|
97
|
+
|
|
98
|
+
- JSON 配置表单字段
|
|
99
|
+
- 支持多种字段类型(text、textarea、number、select、autocomplete、date、time、switch、checkbox、radio)
|
|
100
|
+
- 表单验证
|
|
101
|
+
- 自定义插槽
|
|
102
|
+
- 全屏模式
|
|
103
|
+
- 响应式宽度
|
|
104
|
+
|
|
105
|
+
## 支持的字段类型
|
|
106
|
+
|
|
107
|
+
- \`text\`: 文本输入框
|
|
108
|
+
- \`textarea\`: 多行文本
|
|
109
|
+
- \`number\`: 数字输入框
|
|
110
|
+
- \`select\`: 下拉选择框
|
|
111
|
+
- \`autocomplete\`: 自动完成
|
|
112
|
+
- \`date\`: 日期选择器
|
|
113
|
+
- \`time\`: 时间选择器
|
|
114
|
+
- \`switch\`: 开关
|
|
115
|
+
- \`checkbox\`: 复选框
|
|
116
|
+
- \`radio\`: 单选按钮组
|
|
117
|
+
- \`slot\`: 自定义插槽
|
|
118
|
+
|
|
119
|
+
## 事件
|
|
120
|
+
|
|
121
|
+
- \`confirm\`: 点击确认按钮时触发,参数为表单数据
|
|
122
|
+
- \`cancel\`: 点击取消按钮时触发
|
|
123
|
+
- \`close\`: 弹窗关闭时触发
|
|
124
|
+
- \`input\`: v-model 绑定值变化时触发
|
|
125
|
+
|
|
126
|
+
## 插槽
|
|
127
|
+
|
|
128
|
+
- \`content\`: 自定义弹窗内容(完全自定义)
|
|
129
|
+
- \`field-{key}\`: 自定义字段(当字段类型为 slot 时)
|
|
130
|
+
|
|
131
|
+
## 方法
|
|
132
|
+
|
|
133
|
+
- \`getForm()\`: 获取表单引用
|
|
134
|
+
- \`getFormData()\`: 获取表单数据
|
|
135
|
+
- \`setFieldsValue(values)\`: 设置表单数据
|
|
136
|
+
- \`resetForm()\`: 重置表单
|
|
137
|
+
- \`resetValidation()\`: 重置验证状态
|
|
138
|
+
- \`validate()\`: 验证表单
|
|
139
|
+
`,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// 基础示例
|
|
146
|
+
export const 基础示例 = {
|
|
147
|
+
render: () => ({
|
|
148
|
+
components: { JhModalForm },
|
|
149
|
+
data() {
|
|
150
|
+
return {
|
|
151
|
+
visible: false,
|
|
152
|
+
fields: sampleFields,
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
template: `
|
|
156
|
+
<div>
|
|
157
|
+
<v-btn color="primary" @click="visible = true">
|
|
158
|
+
打开弹窗表单
|
|
159
|
+
</v-btn>
|
|
160
|
+
<jh-modal-form
|
|
161
|
+
v-model="visible"
|
|
162
|
+
title="用户信息"
|
|
163
|
+
:fields="fields"
|
|
164
|
+
@confirm="handleConfirm"
|
|
165
|
+
@cancel="handleCancel"
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
`,
|
|
169
|
+
methods: {
|
|
170
|
+
handleConfirm(data) {
|
|
171
|
+
console.log('表单数据:', data);
|
|
172
|
+
alert('提交成功!\n' + JSON.stringify(data, null, 2));
|
|
173
|
+
this.visible = false;
|
|
174
|
+
},
|
|
175
|
+
handleCancel() {
|
|
176
|
+
console.log('取消操作');
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
}),
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// 编辑模式
|
|
183
|
+
export const 编辑模式 = {
|
|
184
|
+
render: () => ({
|
|
185
|
+
components: { JhModalForm },
|
|
186
|
+
data() {
|
|
187
|
+
return {
|
|
188
|
+
visible: false,
|
|
189
|
+
fields: sampleFields,
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
template: `
|
|
193
|
+
<div>
|
|
194
|
+
<v-btn color="primary" @click="openModal">
|
|
195
|
+
编辑用户
|
|
196
|
+
</v-btn>
|
|
197
|
+
<jh-modal-form
|
|
198
|
+
ref="modalForm"
|
|
199
|
+
v-model="visible"
|
|
200
|
+
title="编辑用户"
|
|
201
|
+
:fields="fields"
|
|
202
|
+
@confirm="handleConfirm"
|
|
203
|
+
/>
|
|
204
|
+
</div>
|
|
205
|
+
`,
|
|
206
|
+
methods: {
|
|
207
|
+
openModal() {
|
|
208
|
+
this.visible = true;
|
|
209
|
+
// 等待弹窗打开后设置数据
|
|
210
|
+
this.$nextTick(() => {
|
|
211
|
+
this.$refs.modalForm.setFieldsValue({
|
|
212
|
+
username: 'zhangsan',
|
|
213
|
+
email: 'zhangsan@example.com',
|
|
214
|
+
phone: '13800138000',
|
|
215
|
+
role: 'admin',
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
},
|
|
219
|
+
handleConfirm(data) {
|
|
220
|
+
console.log('更新数据:', data);
|
|
221
|
+
alert('更新成功!');
|
|
222
|
+
this.visible = false;
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// 复杂表单
|
|
229
|
+
export const 复杂表单 = {
|
|
230
|
+
render: () => ({
|
|
231
|
+
components: { JhModalForm },
|
|
232
|
+
data() {
|
|
233
|
+
return {
|
|
234
|
+
visible: false,
|
|
235
|
+
fields: [
|
|
236
|
+
{
|
|
237
|
+
key: 'name',
|
|
238
|
+
label: '姓名',
|
|
239
|
+
type: 'text',
|
|
240
|
+
rules: 'require',
|
|
241
|
+
placeholder: '请输入姓名',
|
|
242
|
+
cols: 12,
|
|
243
|
+
md: 6,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
key: 'gender',
|
|
247
|
+
label: '性别',
|
|
248
|
+
type: 'radio',
|
|
249
|
+
options: [
|
|
250
|
+
{ text: '男', value: 'male' },
|
|
251
|
+
{ text: '女', value: 'female' },
|
|
252
|
+
],
|
|
253
|
+
cols: 12,
|
|
254
|
+
md: 6,
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
key: 'birthdate',
|
|
258
|
+
label: '出生日期',
|
|
259
|
+
type: 'date',
|
|
260
|
+
cols: 12,
|
|
261
|
+
md: 6,
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
key: 'department',
|
|
265
|
+
label: '部门',
|
|
266
|
+
type: 'select',
|
|
267
|
+
options: [
|
|
268
|
+
{ text: '技术部', value: 'tech' },
|
|
269
|
+
{ text: '产品部', value: 'product' },
|
|
270
|
+
{ text: '市场部', value: 'marketing' },
|
|
271
|
+
],
|
|
272
|
+
rules: 'require',
|
|
273
|
+
cols: 12,
|
|
274
|
+
md: 6,
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
key: 'skills',
|
|
278
|
+
label: '技能',
|
|
279
|
+
type: 'select',
|
|
280
|
+
multiple: true,
|
|
281
|
+
chips: true,
|
|
282
|
+
options: [
|
|
283
|
+
{ text: 'Vue.js', value: 'vue' },
|
|
284
|
+
{ text: 'React', value: 'react' },
|
|
285
|
+
{ text: 'Node.js', value: 'node' },
|
|
286
|
+
],
|
|
287
|
+
cols: 12,
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
key: 'active',
|
|
291
|
+
label: '启用状态',
|
|
292
|
+
type: 'switch',
|
|
293
|
+
switchLabel: '启用',
|
|
294
|
+
cols: 12,
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
key: 'bio',
|
|
298
|
+
label: '个人简介',
|
|
299
|
+
type: 'textarea',
|
|
300
|
+
rows: 4,
|
|
301
|
+
placeholder: '请输入个人简介',
|
|
302
|
+
cols: 12,
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
};
|
|
306
|
+
},
|
|
307
|
+
template: `
|
|
308
|
+
<div>
|
|
309
|
+
<v-btn color="primary" @click="visible = true">
|
|
310
|
+
打开复杂表单
|
|
311
|
+
</v-btn>
|
|
312
|
+
<jh-modal-form
|
|
313
|
+
v-model="visible"
|
|
314
|
+
title="员工信息"
|
|
315
|
+
width="800"
|
|
316
|
+
:fields="fields"
|
|
317
|
+
@confirm="handleConfirm"
|
|
318
|
+
/>
|
|
319
|
+
</div>
|
|
320
|
+
`,
|
|
321
|
+
methods: {
|
|
322
|
+
handleConfirm(data) {
|
|
323
|
+
console.log('表单数据:', data);
|
|
324
|
+
alert('提交成功!');
|
|
325
|
+
this.visible = false;
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
}),
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// 全屏模式
|
|
332
|
+
export const 全屏模式 = {
|
|
333
|
+
render: () => ({
|
|
334
|
+
components: { JhModalForm },
|
|
335
|
+
data() {
|
|
336
|
+
return {
|
|
337
|
+
visible: false,
|
|
338
|
+
fields: [
|
|
339
|
+
{
|
|
340
|
+
key: 'title',
|
|
341
|
+
label: '标题',
|
|
342
|
+
type: 'text',
|
|
343
|
+
rules: 'require',
|
|
344
|
+
placeholder: '请输入标题',
|
|
345
|
+
cols: 12,
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
key: 'content',
|
|
349
|
+
label: '内容',
|
|
350
|
+
type: 'textarea',
|
|
351
|
+
rules: 'require',
|
|
352
|
+
rows: 20,
|
|
353
|
+
placeholder: '请输入内容',
|
|
354
|
+
cols: 12,
|
|
355
|
+
},
|
|
356
|
+
],
|
|
357
|
+
};
|
|
358
|
+
},
|
|
359
|
+
template: `
|
|
360
|
+
<div>
|
|
361
|
+
<v-btn color="primary" @click="visible = true">
|
|
362
|
+
打开全屏表单
|
|
363
|
+
</v-btn>
|
|
364
|
+
<jh-modal-form
|
|
365
|
+
v-model="visible"
|
|
366
|
+
title="编辑文章"
|
|
367
|
+
:fields="fields"
|
|
368
|
+
:fullscreen="true"
|
|
369
|
+
@confirm="handleConfirm"
|
|
370
|
+
/>
|
|
371
|
+
</div>
|
|
372
|
+
`,
|
|
373
|
+
methods: {
|
|
374
|
+
handleConfirm(data) {
|
|
375
|
+
console.log('表单数据:', data);
|
|
376
|
+
alert('提交成功!');
|
|
377
|
+
this.visible = false;
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
}),
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// 自定义内容
|
|
384
|
+
export const 自定义内容 = {
|
|
385
|
+
render: () => ({
|
|
386
|
+
components: { JhModalForm },
|
|
387
|
+
data() {
|
|
388
|
+
return {
|
|
389
|
+
visible: false,
|
|
390
|
+
customData: {
|
|
391
|
+
title: '',
|
|
392
|
+
description: '',
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
},
|
|
396
|
+
template: `
|
|
397
|
+
<div>
|
|
398
|
+
<v-btn color="primary" @click="visible = true">
|
|
399
|
+
打开自定义内容弹窗
|
|
400
|
+
</v-btn>
|
|
401
|
+
<jh-modal-form
|
|
402
|
+
v-model="visible"
|
|
403
|
+
title="自定义表单"
|
|
404
|
+
width="600"
|
|
405
|
+
>
|
|
406
|
+
<template #content>
|
|
407
|
+
<div class="pa-4">
|
|
408
|
+
<v-text-field
|
|
409
|
+
v-model="customData.title"
|
|
410
|
+
label="标题"
|
|
411
|
+
outlined
|
|
412
|
+
dense
|
|
413
|
+
/>
|
|
414
|
+
<v-textarea
|
|
415
|
+
v-model="customData.description"
|
|
416
|
+
label="描述"
|
|
417
|
+
outlined
|
|
418
|
+
dense
|
|
419
|
+
rows="5"
|
|
420
|
+
/>
|
|
421
|
+
<div class="d-flex justify-end pt-4">
|
|
422
|
+
<v-btn text @click="visible = false">取消</v-btn>
|
|
423
|
+
<v-btn color="success" class="ml-2" @click="handleSave">保存</v-btn>
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
</template>
|
|
427
|
+
</jh-modal-form>
|
|
428
|
+
</div>
|
|
429
|
+
`,
|
|
430
|
+
methods: {
|
|
431
|
+
handleSave() {
|
|
432
|
+
console.log('保存数据:', this.customData);
|
|
433
|
+
alert('保存成功!');
|
|
434
|
+
this.visible = false;
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
}),
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
// 自定义验证
|
|
441
|
+
export const 自定义验证 = {
|
|
442
|
+
render: () => ({
|
|
443
|
+
components: { JhModalForm },
|
|
444
|
+
data() {
|
|
445
|
+
return {
|
|
446
|
+
visible: false,
|
|
447
|
+
fields: [
|
|
448
|
+
{
|
|
449
|
+
key: 'username',
|
|
450
|
+
label: '用户名',
|
|
451
|
+
type: 'text',
|
|
452
|
+
rules: [
|
|
453
|
+
v => !!v || '用户名不能为空',
|
|
454
|
+
v => (v && v.length >= 3) || '用户名至少3个字符',
|
|
455
|
+
],
|
|
456
|
+
placeholder: '请输入用户名(至少3个字符)',
|
|
457
|
+
cols: 12,
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
key: 'password',
|
|
461
|
+
label: '密码',
|
|
462
|
+
type: 'text',
|
|
463
|
+
rules: [
|
|
464
|
+
v => !!v || '密码不能为空',
|
|
465
|
+
v => (v && v.length >= 6) || '密码至少6个字符',
|
|
466
|
+
],
|
|
467
|
+
placeholder: '请输入密码(至少6个字符)',
|
|
468
|
+
cols: 12,
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
key: 'age',
|
|
472
|
+
label: '年龄',
|
|
473
|
+
type: 'number',
|
|
474
|
+
rules: [
|
|
475
|
+
v => !!v || '年龄不能为空',
|
|
476
|
+
v => (v >= 18 && v <= 60) || '年龄必须在18-60之间',
|
|
477
|
+
],
|
|
478
|
+
placeholder: '请输入年龄',
|
|
479
|
+
cols: 12,
|
|
480
|
+
},
|
|
481
|
+
],
|
|
482
|
+
};
|
|
483
|
+
},
|
|
484
|
+
template: `
|
|
485
|
+
<div>
|
|
486
|
+
<v-btn color="primary" @click="visible = true">
|
|
487
|
+
打开表单(自定义验证)
|
|
488
|
+
</v-btn>
|
|
489
|
+
<jh-modal-form
|
|
490
|
+
v-model="visible"
|
|
491
|
+
title="用户注册"
|
|
492
|
+
:fields="fields"
|
|
493
|
+
@confirm="handleConfirm"
|
|
494
|
+
/>
|
|
495
|
+
</div>
|
|
496
|
+
`,
|
|
497
|
+
methods: {
|
|
498
|
+
handleConfirm(data) {
|
|
499
|
+
console.log('表单数据:', data);
|
|
500
|
+
alert('注册成功!');
|
|
501
|
+
this.visible = false;
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
}),
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
// 小尺寸
|
|
508
|
+
export const 小尺寸 = {
|
|
509
|
+
render: () => ({
|
|
510
|
+
components: { JhModalForm },
|
|
511
|
+
data() {
|
|
512
|
+
return {
|
|
513
|
+
visible: false,
|
|
514
|
+
fields: [
|
|
515
|
+
{
|
|
516
|
+
key: 'code',
|
|
517
|
+
label: '验证码',
|
|
518
|
+
type: 'text',
|
|
519
|
+
rules: 'require',
|
|
520
|
+
placeholder: '请输入验证码',
|
|
521
|
+
cols: 12,
|
|
522
|
+
},
|
|
523
|
+
],
|
|
524
|
+
};
|
|
525
|
+
},
|
|
526
|
+
template: `
|
|
527
|
+
<div>
|
|
528
|
+
<v-btn color="primary" @click="visible = true">
|
|
529
|
+
打开小尺寸弹窗
|
|
530
|
+
</v-btn>
|
|
531
|
+
<jh-modal-form
|
|
532
|
+
v-model="visible"
|
|
533
|
+
title="验证码确认"
|
|
534
|
+
width="400"
|
|
535
|
+
:fields="fields"
|
|
536
|
+
@confirm="handleConfirm"
|
|
537
|
+
/>
|
|
538
|
+
</div>
|
|
539
|
+
`,
|
|
540
|
+
methods: {
|
|
541
|
+
handleConfirm(data) {
|
|
542
|
+
console.log('验证码:', data);
|
|
543
|
+
alert('验证成功!');
|
|
544
|
+
this.visible = false;
|
|
545
|
+
},
|
|
546
|
+
},
|
|
547
|
+
}),
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// 可点击外部关闭
|
|
551
|
+
export const 可点击外部关闭 = {
|
|
552
|
+
render: () => ({
|
|
553
|
+
components: { JhModalForm },
|
|
554
|
+
data() {
|
|
555
|
+
return {
|
|
556
|
+
visible: false,
|
|
557
|
+
fields: [
|
|
558
|
+
{
|
|
559
|
+
key: 'agreement',
|
|
560
|
+
label: '同意协议',
|
|
561
|
+
type: 'checkbox',
|
|
562
|
+
checkboxLabel: '我已阅读并同意用户协议',
|
|
563
|
+
rules: [v => !!v || '必须同意协议才能继续'],
|
|
564
|
+
cols: 12,
|
|
565
|
+
},
|
|
566
|
+
],
|
|
567
|
+
};
|
|
568
|
+
},
|
|
569
|
+
template: `
|
|
570
|
+
<div>
|
|
571
|
+
<v-btn color="primary" @click="visible = true">
|
|
572
|
+
打开协议弹窗(点击外部可关闭)
|
|
573
|
+
</v-btn>
|
|
574
|
+
<jh-modal-form
|
|
575
|
+
v-model="visible"
|
|
576
|
+
title="用户协议"
|
|
577
|
+
width="500"
|
|
578
|
+
:persistent="false"
|
|
579
|
+
:fields="fields"
|
|
580
|
+
@confirm="handleConfirm"
|
|
581
|
+
/>
|
|
582
|
+
</div>
|
|
583
|
+
`,
|
|
584
|
+
methods: {
|
|
585
|
+
handleConfirm(data) {
|
|
586
|
+
console.log('已同意:', data);
|
|
587
|
+
alert('已同意协议!');
|
|
588
|
+
this.visible = false;
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
}),
|
|
592
|
+
};
|