二次确认

This commit is contained in:
2025-06-30 17:13:34 +08:00
parent f368f15a99
commit 20378b1b6e
10 changed files with 131 additions and 63 deletions

21
utils/utils.js Normal file
View File

@@ -0,0 +1,21 @@
export function confirmAction(title = "确认操作", content = "确定要执行此操作吗?", confirmCallback) {
return new Promise((resolve, reject) => {
uni.showModal({
title: title,
content: content,
showCancel: true,
success: (res) => {
if (res.confirm) {
console.log("用户点击了“确定”按钮");
resolve(true); // 调用确认回调
if (confirmCallback) {
confirmCallback();
}
} else if (res.cancel) {
console.log("用户点击了“取消”按钮");
resolve(false);
}
}
});
});
}