Browse Source
fix: alert send wrong confirm state to beforeClose (#5991)
* 修复alert在按下Esc或者点击遮罩关闭时,可能发送错误的isConfirm状态
pull/5992/head
Netfan
10 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
4 deletions
-
packages/@core/ui-kit/popup-ui/src/alert/alert.vue
|
|
|
@ -91,14 +91,13 @@ const getIconRender = computed(() => { |
|
|
|
}); |
|
|
|
|
|
|
|
function doCancel() { |
|
|
|
isConfirm.value = false; |
|
|
|
handleCancel(); |
|
|
|
handleOpenChange(false); |
|
|
|
} |
|
|
|
|
|
|
|
function doConfirm() { |
|
|
|
isConfirm.value = true; |
|
|
|
handleConfirm(); |
|
|
|
handleOpenChange(false); |
|
|
|
emits('confirm'); |
|
|
|
} |
|
|
|
|
|
|
|
provideAlertContext({ |
|
|
|
@ -117,11 +116,13 @@ function handleCancel() { |
|
|
|
|
|
|
|
const loading = ref(false); |
|
|
|
async function handleOpenChange(val: boolean) { |
|
|
|
const confirmState = isConfirm.value; |
|
|
|
isConfirm.value = false; |
|
|
|
await nextTick(); |
|
|
|
if (!val && props.beforeClose) { |
|
|
|
loading.value = true; |
|
|
|
try { |
|
|
|
const res = await props.beforeClose({ isConfirm: isConfirm.value }); |
|
|
|
const res = await props.beforeClose({ isConfirm: confirmState }); |
|
|
|
if (res !== false) { |
|
|
|
open.value = false; |
|
|
|
} |
|
|
|
|