fix: 弹窗点击遮罩层(外部区域)即可关闭
This commit is contained in:
@@ -239,4 +239,18 @@ export function bindGlobalDialogControls() {
|
|||||||
window.chatDialog?._cancel?.();
|
window.chatDialog?._cancel?.();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 点击遮罩层(弹窗外部)关闭弹窗
|
||||||
|
document.addEventListener("click", (event) => {
|
||||||
|
const modal = document.getElementById("global-dialog-modal");
|
||||||
|
if (!modal || modal.style.display === "none") return;
|
||||||
|
if (event.target === modal) {
|
||||||
|
// alert 模式直接隐藏,confirm/prompt 视为取消
|
||||||
|
if (currentDialogType === "alert") {
|
||||||
|
window.chatDialog?._hide?.();
|
||||||
|
} else {
|
||||||
|
window.chatDialog?._cancel?.();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user