我需要通过显示“详细信息”的按钮显示甜蜜警报,点击此按钮,用户可以重定向到另一个页面。我希望它保留'错误'甜蜜警报的风格。有可能吗?
Buttons button = new Buttons();
simple_button = button.addSimpleButton("red", "simpleButton", "large", "google.com","", "test");
答案 0 :(得分:1)
试试这个:检查snnipet
sweetAlert({
title: "Sorry but error occurred",
text: "Sorry but error occurred",
type: "error",
allowEscapeKey: true,
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Detail",
cancelButtonText: "Cancel",
closeOnConfirm: false,
closeOnCancel: true
}, function (isConfirm) {
if (isConfirm) {
window.location.href ="www.yoururl.com/index.php";
}
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
&#13;