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,550 @@
|
|
|
1
|
+
import JhConfirmDialog from './JhConfirmDialog.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: '基础组件/JhConfirmDialog - 确认对话框',
|
|
5
|
+
component: JhConfirmDialog,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
value: {
|
|
9
|
+
control: 'boolean',
|
|
10
|
+
description: '是否显示对话框',
|
|
11
|
+
table: {
|
|
12
|
+
defaultValue: { summary: 'false' },
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
title: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: '标题',
|
|
18
|
+
table: {
|
|
19
|
+
defaultValue: { summary: '提示' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
content: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: '内容(支持HTML)',
|
|
25
|
+
table: {
|
|
26
|
+
defaultValue: { summary: '' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
maxWidth: {
|
|
30
|
+
control: 'number',
|
|
31
|
+
description: '最大宽度',
|
|
32
|
+
table: {
|
|
33
|
+
defaultValue: { summary: '420' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
showCancelButton: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
description: '是否显示取消按钮',
|
|
39
|
+
table: {
|
|
40
|
+
defaultValue: { summary: 'true' },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
confirmButtonText: {
|
|
44
|
+
control: 'text',
|
|
45
|
+
description: '确认按钮文本',
|
|
46
|
+
table: {
|
|
47
|
+
defaultValue: { summary: '确定' },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
cancelButtonText: {
|
|
51
|
+
control: 'text',
|
|
52
|
+
description: '取消按钮文本',
|
|
53
|
+
table: {
|
|
54
|
+
defaultValue: { summary: '取消' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
persistent: {
|
|
58
|
+
control: 'boolean',
|
|
59
|
+
description: '是否持久化(点击外部不关闭)',
|
|
60
|
+
table: {
|
|
61
|
+
defaultValue: { summary: 'false' },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// 基础示例
|
|
68
|
+
export const 基础示例 = {
|
|
69
|
+
render: () => ({
|
|
70
|
+
components: { JhConfirmDialog },
|
|
71
|
+
data() {
|
|
72
|
+
return {
|
|
73
|
+
show: false,
|
|
74
|
+
result: '',
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
template: `
|
|
78
|
+
<div>
|
|
79
|
+
<v-btn @click="show = true">显示对话框</v-btn>
|
|
80
|
+
<p class="mt-2">操作结果: {{ result }}</p>
|
|
81
|
+
<jh-confirm-dialog
|
|
82
|
+
v-model="show"
|
|
83
|
+
title="确认操作"
|
|
84
|
+
content="确定要执行此操作吗?"
|
|
85
|
+
@confirm="result = '已确认'"
|
|
86
|
+
@cancel="result = '已取消'"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
`,
|
|
90
|
+
}),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// 仅确定按钮
|
|
94
|
+
export const 仅确定按钮 = {
|
|
95
|
+
render: () => ({
|
|
96
|
+
components: { JhConfirmDialog },
|
|
97
|
+
data() {
|
|
98
|
+
return {
|
|
99
|
+
show: false,
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
template: `
|
|
103
|
+
<div>
|
|
104
|
+
<v-btn @click="show = true">显示提示</v-btn>
|
|
105
|
+
<jh-confirm-dialog
|
|
106
|
+
v-model="show"
|
|
107
|
+
title="提示"
|
|
108
|
+
content="这是一条重要提示信息"
|
|
109
|
+
:show-cancel-button="false"
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
`,
|
|
113
|
+
}),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// 自定义按钮
|
|
117
|
+
export const 自定义按钮 = {
|
|
118
|
+
render: () => ({
|
|
119
|
+
components: { JhConfirmDialog },
|
|
120
|
+
data() {
|
|
121
|
+
return {
|
|
122
|
+
show1: false,
|
|
123
|
+
show2: false,
|
|
124
|
+
show3: false,
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
template: `
|
|
128
|
+
<div>
|
|
129
|
+
<v-btn class="mr-2" color="error" @click="show1 = true">删除确认</v-btn>
|
|
130
|
+
<v-btn class="mr-2" color="warning" @click="show2 = true">警告确认</v-btn>
|
|
131
|
+
<v-btn color="success" @click="show3 = true">保存确认</v-btn>
|
|
132
|
+
|
|
133
|
+
<jh-confirm-dialog
|
|
134
|
+
v-model="show1"
|
|
135
|
+
title="删除确认"
|
|
136
|
+
content="删除后将无法恢复,确定要删除吗?"
|
|
137
|
+
confirm-button-text="删除"
|
|
138
|
+
confirm-button-color="error"
|
|
139
|
+
/>
|
|
140
|
+
|
|
141
|
+
<jh-confirm-dialog
|
|
142
|
+
v-model="show2"
|
|
143
|
+
title="警告"
|
|
144
|
+
content="此操作可能会产生风险,是否继续?"
|
|
145
|
+
confirm-button-text="继续"
|
|
146
|
+
confirm-button-color="warning"
|
|
147
|
+
cancel-button-text="放弃"
|
|
148
|
+
/>
|
|
149
|
+
|
|
150
|
+
<jh-confirm-dialog
|
|
151
|
+
v-model="show3"
|
|
152
|
+
title="保存确认"
|
|
153
|
+
content="是否保存当前修改?"
|
|
154
|
+
confirm-button-text="保存"
|
|
155
|
+
confirm-button-color="success"
|
|
156
|
+
cancel-button-text="不保存"
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
`,
|
|
160
|
+
}),
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// HTML内容
|
|
164
|
+
export const HTML内容 = {
|
|
165
|
+
render: () => ({
|
|
166
|
+
components: { JhConfirmDialog },
|
|
167
|
+
data() {
|
|
168
|
+
return {
|
|
169
|
+
show: false,
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
template: `
|
|
173
|
+
<div>
|
|
174
|
+
<v-btn @click="show = true">显示 HTML 内容</v-btn>
|
|
175
|
+
<jh-confirm-dialog
|
|
176
|
+
v-model="show"
|
|
177
|
+
title="提示"
|
|
178
|
+
content="<p>这是 <strong>HTML</strong> 内容</p><ul><li>支持列表</li><li>支持<em>格式化</em></li></ul>"
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
`,
|
|
182
|
+
}),
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// 自定义内容
|
|
186
|
+
export const 自定义内容 = {
|
|
187
|
+
render: () => ({
|
|
188
|
+
components: { JhConfirmDialog },
|
|
189
|
+
data() {
|
|
190
|
+
return {
|
|
191
|
+
show: false,
|
|
192
|
+
username: '',
|
|
193
|
+
password: '',
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
template: `
|
|
197
|
+
<div>
|
|
198
|
+
<v-btn @click="show = true">登录</v-btn>
|
|
199
|
+
<jh-confirm-dialog
|
|
200
|
+
v-model="show"
|
|
201
|
+
title="用户登录"
|
|
202
|
+
confirm-button-text="登录"
|
|
203
|
+
@confirm="handleLogin"
|
|
204
|
+
>
|
|
205
|
+
<v-text-field
|
|
206
|
+
v-model="username"
|
|
207
|
+
label="用户名"
|
|
208
|
+
outlined
|
|
209
|
+
dense
|
|
210
|
+
class="mb-2"
|
|
211
|
+
></v-text-field>
|
|
212
|
+
<v-text-field
|
|
213
|
+
v-model="password"
|
|
214
|
+
label="密码"
|
|
215
|
+
type="password"
|
|
216
|
+
outlined
|
|
217
|
+
dense
|
|
218
|
+
></v-text-field>
|
|
219
|
+
</jh-confirm-dialog>
|
|
220
|
+
</div>
|
|
221
|
+
`,
|
|
222
|
+
methods: {
|
|
223
|
+
handleLogin() {
|
|
224
|
+
console.log('登录:', this.username, this.password);
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
}),
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// 自定义标题
|
|
231
|
+
export const 自定义标题 = {
|
|
232
|
+
render: () => ({
|
|
233
|
+
components: { JhConfirmDialog },
|
|
234
|
+
data() {
|
|
235
|
+
return {
|
|
236
|
+
show: false,
|
|
237
|
+
};
|
|
238
|
+
},
|
|
239
|
+
template: `
|
|
240
|
+
<div>
|
|
241
|
+
<v-btn @click="show = true">显示自定义标题</v-btn>
|
|
242
|
+
<jh-confirm-dialog
|
|
243
|
+
v-model="show"
|
|
244
|
+
content="这是一个自定义标题的对话框"
|
|
245
|
+
>
|
|
246
|
+
<template v-slot:title>
|
|
247
|
+
<v-icon color="warning" class="mr-2">mdi-alert</v-icon>
|
|
248
|
+
<span>警告提示</span>
|
|
249
|
+
</template>
|
|
250
|
+
</jh-confirm-dialog>
|
|
251
|
+
</div>
|
|
252
|
+
`,
|
|
253
|
+
}),
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// 异步确认
|
|
257
|
+
export const 异步确认 = {
|
|
258
|
+
render: () => ({
|
|
259
|
+
components: { JhConfirmDialog },
|
|
260
|
+
data() {
|
|
261
|
+
return {
|
|
262
|
+
show: false,
|
|
263
|
+
loading: false,
|
|
264
|
+
status: '',
|
|
265
|
+
};
|
|
266
|
+
},
|
|
267
|
+
methods: {
|
|
268
|
+
async handleConfirm() {
|
|
269
|
+
this.loading = true;
|
|
270
|
+
this.status = '处理中...';
|
|
271
|
+
|
|
272
|
+
// 模拟异步操作
|
|
273
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
274
|
+
|
|
275
|
+
this.loading = false;
|
|
276
|
+
this.show = false;
|
|
277
|
+
this.status = '操作成功!';
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
template: `
|
|
281
|
+
<div>
|
|
282
|
+
<v-btn @click="show = true">异步确认</v-btn>
|
|
283
|
+
<p class="mt-2">状态: {{ status }}</p>
|
|
284
|
+
<jh-confirm-dialog
|
|
285
|
+
v-model="show"
|
|
286
|
+
title="异步操作"
|
|
287
|
+
content="点击确定后会执行异步操作"
|
|
288
|
+
:loading="loading"
|
|
289
|
+
@confirm="handleConfirm"
|
|
290
|
+
@cancel="status = '已取消'"
|
|
291
|
+
/>
|
|
292
|
+
</div>
|
|
293
|
+
`,
|
|
294
|
+
}),
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// 确认前钩子
|
|
298
|
+
export const 确认前钩子 = {
|
|
299
|
+
render: () => ({
|
|
300
|
+
components: { JhConfirmDialog },
|
|
301
|
+
data() {
|
|
302
|
+
return {
|
|
303
|
+
show: false,
|
|
304
|
+
input: '',
|
|
305
|
+
message: '',
|
|
306
|
+
};
|
|
307
|
+
},
|
|
308
|
+
methods: {
|
|
309
|
+
async beforeConfirm() {
|
|
310
|
+
if (this.input.trim() === '') {
|
|
311
|
+
this.message = '请输入内容';
|
|
312
|
+
return false; // 阻止关闭
|
|
313
|
+
}
|
|
314
|
+
if (this.input !== '123456') {
|
|
315
|
+
this.message = '密码错误';
|
|
316
|
+
return false; // 阻止关闭
|
|
317
|
+
}
|
|
318
|
+
this.message = '验证通过';
|
|
319
|
+
return true; // 允许关闭
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
template: `
|
|
323
|
+
<div>
|
|
324
|
+
<v-btn @click="show = true; input = ''; message = ''">显示验证对话框</v-btn>
|
|
325
|
+
<p class="mt-2">{{ message }}</p>
|
|
326
|
+
<jh-confirm-dialog
|
|
327
|
+
v-model="show"
|
|
328
|
+
title="验证"
|
|
329
|
+
:before-confirm="beforeConfirm"
|
|
330
|
+
>
|
|
331
|
+
<v-text-field
|
|
332
|
+
v-model="input"
|
|
333
|
+
label="请输入密码(123456)"
|
|
334
|
+
outlined
|
|
335
|
+
dense
|
|
336
|
+
hint="提示: 正确密码是 123456"
|
|
337
|
+
persistent-hint
|
|
338
|
+
></v-text-field>
|
|
339
|
+
<p class="red--text text-caption mt-2">{{ message }}</p>
|
|
340
|
+
</jh-confirm-dialog>
|
|
341
|
+
</div>
|
|
342
|
+
`,
|
|
343
|
+
}),
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// 持久化对话框
|
|
347
|
+
export const 持久化对话框 = {
|
|
348
|
+
render: () => ({
|
|
349
|
+
components: { JhConfirmDialog },
|
|
350
|
+
data() {
|
|
351
|
+
return {
|
|
352
|
+
show: false,
|
|
353
|
+
};
|
|
354
|
+
},
|
|
355
|
+
template: `
|
|
356
|
+
<div>
|
|
357
|
+
<v-btn @click="show = true">显示持久化对话框</v-btn>
|
|
358
|
+
<p class="mt-2 text-caption">点击外部不会关闭,必须点击按钮</p>
|
|
359
|
+
<jh-confirm-dialog
|
|
360
|
+
v-model="show"
|
|
361
|
+
title="重要提示"
|
|
362
|
+
content="这是一个持久化对话框,点击外部不会关闭"
|
|
363
|
+
persistent
|
|
364
|
+
/>
|
|
365
|
+
</div>
|
|
366
|
+
`,
|
|
367
|
+
}),
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
// 不同宽度
|
|
371
|
+
export const 不同宽度 = {
|
|
372
|
+
render: () => ({
|
|
373
|
+
components: { JhConfirmDialog },
|
|
374
|
+
data() {
|
|
375
|
+
return {
|
|
376
|
+
show1: false,
|
|
377
|
+
show2: false,
|
|
378
|
+
show3: false,
|
|
379
|
+
};
|
|
380
|
+
},
|
|
381
|
+
template: `
|
|
382
|
+
<div>
|
|
383
|
+
<v-btn class="mr-2" @click="show1 = true">小(290px)</v-btn>
|
|
384
|
+
<v-btn class="mr-2" @click="show2 = true">中(420px)</v-btn>
|
|
385
|
+
<v-btn @click="show3 = true">大(600px)</v-btn>
|
|
386
|
+
|
|
387
|
+
<jh-confirm-dialog
|
|
388
|
+
v-model="show1"
|
|
389
|
+
title="小对话框"
|
|
390
|
+
content="这是一个较小的对话框"
|
|
391
|
+
:max-width="290"
|
|
392
|
+
/>
|
|
393
|
+
|
|
394
|
+
<jh-confirm-dialog
|
|
395
|
+
v-model="show2"
|
|
396
|
+
title="中对话框"
|
|
397
|
+
content="这是一个中等大小的对话框"
|
|
398
|
+
:max-width="420"
|
|
399
|
+
/>
|
|
400
|
+
|
|
401
|
+
<jh-confirm-dialog
|
|
402
|
+
v-model="show3"
|
|
403
|
+
title="大对话框"
|
|
404
|
+
content="这是一个较大的对话框,可以容纳更多内容。可以用于显示详细的信息或者包含更复杂的表单。"
|
|
405
|
+
:max-width="600"
|
|
406
|
+
/>
|
|
407
|
+
</div>
|
|
408
|
+
`,
|
|
409
|
+
}),
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// 删除确认
|
|
413
|
+
export const 删除确认 = {
|
|
414
|
+
render: () => ({
|
|
415
|
+
components: { JhConfirmDialog },
|
|
416
|
+
data() {
|
|
417
|
+
return {
|
|
418
|
+
show: false,
|
|
419
|
+
items: [
|
|
420
|
+
{ id: 1, name: '项目 A' },
|
|
421
|
+
{ id: 2, name: '项目 B' },
|
|
422
|
+
{ id: 3, name: '项目 C' },
|
|
423
|
+
],
|
|
424
|
+
deleteItem: null,
|
|
425
|
+
};
|
|
426
|
+
},
|
|
427
|
+
methods: {
|
|
428
|
+
confirmDelete(item) {
|
|
429
|
+
this.deleteItem = item;
|
|
430
|
+
this.show = true;
|
|
431
|
+
},
|
|
432
|
+
handleDelete() {
|
|
433
|
+
if (this.deleteItem) {
|
|
434
|
+
const index = this.items.findIndex((i) => i.id === this.deleteItem.id);
|
|
435
|
+
if (index > -1) {
|
|
436
|
+
this.items.splice(index, 1);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
this.show = false;
|
|
440
|
+
this.deleteItem = null;
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
template: `
|
|
444
|
+
<div>
|
|
445
|
+
<v-list>
|
|
446
|
+
<v-list-item v-for="item in items" :key="item.id">
|
|
447
|
+
<v-list-item-content>
|
|
448
|
+
<v-list-item-title>{{ item.name }}</v-list-item-title>
|
|
449
|
+
</v-list-item-content>
|
|
450
|
+
<v-list-item-action>
|
|
451
|
+
<v-btn icon color="error" @click="confirmDelete(item)">
|
|
452
|
+
<v-icon>mdi-delete</v-icon>
|
|
453
|
+
</v-btn>
|
|
454
|
+
</v-list-item-action>
|
|
455
|
+
</v-list-item>
|
|
456
|
+
</v-list>
|
|
457
|
+
|
|
458
|
+
<jh-confirm-dialog
|
|
459
|
+
v-model="show"
|
|
460
|
+
title="删除确认"
|
|
461
|
+
:content="deleteItem ? '确定要删除 "' + deleteItem.name + '" 吗?' : ''"
|
|
462
|
+
confirm-button-text="删除"
|
|
463
|
+
confirm-button-color="error"
|
|
464
|
+
@confirm="handleDelete"
|
|
465
|
+
/>
|
|
466
|
+
</div>
|
|
467
|
+
`,
|
|
468
|
+
}),
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
// 表单提交确认
|
|
472
|
+
export const 表单提交确认 = {
|
|
473
|
+
render: () => ({
|
|
474
|
+
components: { JhConfirmDialog },
|
|
475
|
+
data() {
|
|
476
|
+
return {
|
|
477
|
+
show: false,
|
|
478
|
+
loading: false,
|
|
479
|
+
form: {
|
|
480
|
+
name: '',
|
|
481
|
+
email: '',
|
|
482
|
+
message: '',
|
|
483
|
+
},
|
|
484
|
+
status: '',
|
|
485
|
+
};
|
|
486
|
+
},
|
|
487
|
+
methods: {
|
|
488
|
+
showConfirm() {
|
|
489
|
+
if (!this.form.name || !this.form.email || !this.form.message) {
|
|
490
|
+
alert('请填写完整表单');
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
this.show = true;
|
|
494
|
+
},
|
|
495
|
+
async handleSubmit() {
|
|
496
|
+
this.loading = true;
|
|
497
|
+
this.status = '提交中...';
|
|
498
|
+
|
|
499
|
+
// 模拟提交
|
|
500
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
501
|
+
|
|
502
|
+
this.loading = false;
|
|
503
|
+
this.show = false;
|
|
504
|
+
this.status = '提交成功!';
|
|
505
|
+
|
|
506
|
+
// 重置表单
|
|
507
|
+
this.form = { name: '', email: '', message: '' };
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
template: `
|
|
511
|
+
<div>
|
|
512
|
+
<v-form>
|
|
513
|
+
<v-text-field
|
|
514
|
+
v-model="form.name"
|
|
515
|
+
label="姓名"
|
|
516
|
+
outlined
|
|
517
|
+
dense
|
|
518
|
+
></v-text-field>
|
|
519
|
+
<v-text-field
|
|
520
|
+
v-model="form.email"
|
|
521
|
+
label="邮箱"
|
|
522
|
+
outlined
|
|
523
|
+
dense
|
|
524
|
+
></v-text-field>
|
|
525
|
+
<v-textarea
|
|
526
|
+
v-model="form.message"
|
|
527
|
+
label="留言"
|
|
528
|
+
outlined
|
|
529
|
+
dense
|
|
530
|
+
rows="3"
|
|
531
|
+
></v-textarea>
|
|
532
|
+
<v-btn color="primary" @click="showConfirm">提交</v-btn>
|
|
533
|
+
</v-form>
|
|
534
|
+
|
|
535
|
+
<p class="mt-2">{{ status }}</p>
|
|
536
|
+
|
|
537
|
+
<jh-confirm-dialog
|
|
538
|
+
v-model="show"
|
|
539
|
+
title="确认提交"
|
|
540
|
+
content="请确认您的信息无误后提交"
|
|
541
|
+
confirm-button-text="提交"
|
|
542
|
+
confirm-button-color="primary"
|
|
543
|
+
:loading="loading"
|
|
544
|
+
@confirm="handleSubmit"
|
|
545
|
+
@cancel="status = '已取消提交'"
|
|
546
|
+
/>
|
|
547
|
+
</div>
|
|
548
|
+
`,
|
|
549
|
+
}),
|
|
550
|
+
};
|