File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ function onAlertClosed() {
47
47
isConfirm .value = false ;
48
48
}
49
49
50
+ function onEscapeKeyDown() {
51
+ isConfirm .value = false ;
52
+ }
53
+
50
54
const getIconRender = computed (() => {
51
55
let iconRender: Component | null = null ;
52
56
if (props .icon ) {
@@ -116,13 +120,11 @@ function handleCancel() {
116
120
117
121
const loading = ref (false );
118
122
async function handleOpenChange(val : boolean ) {
119
- const confirmState = isConfirm .value ;
120
- isConfirm .value = false ;
121
- await nextTick ();
123
+ await nextTick (); // 等待标记isConfirm状态
122
124
if (! val && props .beforeClose ) {
123
125
loading .value = true ;
124
126
try {
125
- const res = await props .beforeClose ({ isConfirm: confirmState });
127
+ const res = await props .beforeClose ({ isConfirm: isConfirm . value });
126
128
if (res !== false ) {
127
129
open .value = false ;
128
130
}
@@ -142,6 +144,7 @@ async function handleOpenChange(val: boolean) {
142
144
:overlay-blur =" overlayBlur"
143
145
@opened =" emits('opened')"
144
146
@closed =" onAlertClosed"
147
+ @escape-key-down =" onEscapeKeyDown"
145
148
:class ="
146
149
cn(
147
150
containerClass,
You can’t perform that action at this time.
0 commit comments