二次确认
This commit is contained in:
@@ -36,4 +36,27 @@ export const dateFtt = date => {
|
||||
}
|
||||
return new Date(Date.parse(date))
|
||||
}
|
||||
|
||||
/**
|
||||
* 二次确认弹框
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user