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() {
4747 isConfirm .value = false ;
4848}
4949
50+ function onEscapeKeyDown() {
51+ isConfirm .value = false ;
52+ }
53+
5054const getIconRender = computed (() => {
5155 let iconRender: Component | null = null ;
5256 if (props .icon ) {
@@ -116,13 +120,11 @@ function handleCancel() {
116120
117121const loading = ref (false );
118122async function handleOpenChange(val : boolean ) {
119- const confirmState = isConfirm .value ;
120- isConfirm .value = false ;
121- await nextTick ();
123+ await nextTick (); // 等待标记isConfirm状态
122124 if (! val && props .beforeClose ) {
123125 loading .value = true ;
124126 try {
125- const res = await props .beforeClose ({ isConfirm: confirmState });
127+ const res = await props .beforeClose ({ isConfirm: isConfirm . value });
126128 if (res !== false ) {
127129 open .value = false ;
128130 }
@@ -142,6 +144,7 @@ async function handleOpenChange(val: boolean) {
142144 :overlay-blur =" overlayBlur"
143145 @opened =" emits('opened')"
144146 @closed =" onAlertClosed"
147+ @escape-key-down =" onEscapeKeyDown"
145148 :class ="
146149 cn(
147150 containerClass,
You can’t perform that action at this time.
0 commit comments