fix: alert beforeClose callback arguments fixed (#5845)

This commit is contained in:
Netfan
2025-04-01 22:55:29 +08:00
committed by GitHub
parent 1d9f1be004
commit ecf518bb02
5 changed files with 43 additions and 21 deletions

View File

@@ -129,7 +129,8 @@ onBeforeUnmount(() => {
function openConfirm() {
confirm({
beforeClose() {
beforeClose({ isConfirm }) {
if (!isConfirm) return;
// 这里可以做一些异步操作
return new Promise((resolve) => {
setTimeout(() => {
@@ -150,8 +151,8 @@ function openConfirm() {
async function openPrompt() {
prompt<string>({
async beforeClose(val) {
if (val === '芝士') {
async beforeClose({ isConfirm, value }) {
if (isConfirm && value === '芝士') {
message.error('不能吃芝士');
return false;
}