SweetAlert2 - 一个强大的纯Js模态消息对话框插件
layui.use(["okSweetAlert2"], function () {
let okSweetAlert2 = layui.okSweetAlert2;
okSweetAlert2.fire("欢迎使用ok-admin");
okSweetAlert2.fire(
"关于ok-admin的问题",
"你觉得ok-admin好用吗?",
"question"
);
okSweetAlert2.fire({
type: "error",
title: "糟糕",
text: "服务器好像开小差了!",
footer: "为什么会有这个问题?"
});
okSweetAlert2.fire({
type: "info",
title: "HTML example",
html: "You can use bold text, links and other HTML tags",
showCloseButton: true,
showCancelButton: true,
focusConfirm: false,
confirmButtonText: " Great!",
confirmButtonAriaLabel: "Thumbs up, great!",
cancelButtonText: "",
cancelButtonAriaLabel: "Thumbs down"
});
okSweetAlert2.fire({
type: "warning",
title: "你确定要这样操作吗?",
text: "此操作您将无法还原!",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "确定",
cancelButtonText: "取消"
}).then((result) => {
if (result.value) {
okSweetAlert2.fire(
"删除成功",
"您已经将该记录删除成功!",
"success"
)
}
});
});