From 461c6a6f566f161984871e94bd46136b799c3efc Mon Sep 17 00:00:00 2001 From: pllx Date: Tue, 28 Apr 2026 23:18:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=B9=E7=AA=97=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=81=AE=E7=BD=A9=E5=B1=82=EF=BC=88=E5=A4=96=E9=83=A8=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=EF=BC=89=E5=8D=B3=E5=8F=AF=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/js/chat-room/dialog.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/js/chat-room/dialog.js b/resources/js/chat-room/dialog.js index 63b4284..341cc98 100644 --- a/resources/js/chat-room/dialog.js +++ b/resources/js/chat-room/dialog.js @@ -239,4 +239,18 @@ export function bindGlobalDialogControls() { 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?.(); + } + } + }); }