File tree 4 files changed +46
-1
lines changed
4 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -69,8 +69,14 @@ export type AlertProps = {
69
69
contentClass? : string ;
70
70
/** 执行beforeClose回调期间,在内容区域显示一个loading遮罩*/
71
71
contentMasking? : boolean ;
72
+ /** 弹窗底部内容(与按钮在同一个容器中) */
73
+ footer? : Component | string ;
72
74
/** 弹窗的图标(在标题的前面) */
73
75
icon? : Component | IconType ;
76
+ /**
77
+ * 弹窗遮罩模糊效果
78
+ */
79
+ overlayBlur? : number ;
74
80
/** 是否显示取消按钮 */
75
81
showCancel? : boolean ;
76
82
/** 弹窗标题 */
Original file line number Diff line number Diff line change 1
1
<script lang="ts" setup>
2
+ import { h , ref } from ' vue' ;
3
+
2
4
import { alert , confirm , VbenButton } from ' @vben/common-ui' ;
3
5
6
+ import { Checkbox , message } from ' ant-design-vue' ;
7
+
4
8
function showConfirm() {
5
9
confirm (' This is an alert message' )
6
10
.then (() => {
@@ -18,6 +22,34 @@ function showIconConfirm() {
18
22
});
19
23
}
20
24
25
+ function showfooterConfirm() {
26
+ const checked = ref (false );
27
+ confirm ({
28
+ cancelText: ' 不要虾扯蛋' ,
29
+ confirmText: ' 是的,我们都是NPC' ,
30
+ content:
31
+ ' 刚才发生的事情,为什么我似乎早就经历过一般?\n 我甚至能在事情发生过程中潜意识里预知到接下来会发生什么。\n\n 听起来挺玄乎的,你有过这种感觉吗?' ,
32
+ footer : () =>
33
+ h (
34
+ Checkbox ,
35
+ {
36
+ checked: checked .value ,
37
+ class: ' flex-1' ,
38
+ ' onUpdate:checked' : (v ) => (checked .value = v ),
39
+ },
40
+ ' 不再提示' ,
41
+ ),
42
+ icon: ' question' ,
43
+ title: ' 未解之谜' ,
44
+ }).then (() => {
45
+ if (checked .value ) {
46
+ message .success (' 我不会再拿这个问题烦你了' );
47
+ } else {
48
+ message .info (' 下次还要继续问你哟' );
49
+ }
50
+ });
51
+ }
52
+
21
53
function showAsyncConfirm() {
22
54
confirm ({
23
55
beforeClose({ isConfirm }) {
@@ -37,6 +69,7 @@ function showAsyncConfirm() {
37
69
<div class =" flex gap-4" >
38
70
<VbenButton @click =" showConfirm" >Confirm</VbenButton >
39
71
<VbenButton @click =" showIconConfirm" >Confirm With Icon</VbenButton >
72
+ <VbenButton @click =" showfooterConfirm" >Confirm With Footer</VbenButton >
40
73
<VbenButton @click =" showAsyncConfirm" >Async Confirm</VbenButton >
41
74
</div >
42
75
</template >
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ export type AlertProps = {
34
34
contentClass ?: string ;
35
35
/** 执行beforeClose回调期间,在内容区域显示一个loading遮罩*/
36
36
contentMasking ?: boolean ;
37
+ /** 弹窗底部内容(与按钮在同一个容器中) */
38
+ footer ?: Component | string ;
37
39
/** 弹窗的图标(在标题的前面) */
38
40
icon ?: Component | IconType ;
39
41
/**
Original file line number Diff line number Diff line change @@ -157,7 +157,11 @@ async function handleOpenChange(val: boolean) {
157
157
</div >
158
158
<VbenLoading v-if =" loading && contentMasking" :spinning =" loading" />
159
159
</AlertDialogDescription >
160
- <div class =" flex justify-end gap-x-2" :class =" `justify-${buttonAlign}`" >
160
+ <div
161
+ class =" flex items-center justify-end gap-x-2"
162
+ :class =" `justify-${buttonAlign}`"
163
+ >
164
+ <VbenRenderContent :content =" footer" />
161
165
<AlertDialogCancel v-if =" showCancel" as-child >
162
166
<component
163
167
:is =" components.DefaultButton || VbenButton"
You can’t perform that action at this time.
0 commit comments