我试图改变取消按钮的颜色,就像我可以确认按钮,但它似乎不工作的原因。SweetAlert - 更改颜色的按钮
(SEE https://jsfiddle.net/x20ra1o1/))
代码是:
swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, cancelButtonColor: "#DD6B55", confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plx!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { swal("Deleted!", "Your imaginary file has been deleted.", "success"); } else { swal("Cancelled", "Your imaginary file is safe :)", "error"); } });
'cancelButtonColor'不是[该API]中的一个选项(http://t4t5.github.io/sweetalert/) – chazsolo
我看不出在这个文档中该选项。也许在那里不支持。你总是可以用CSS创建你自己的类。 –
试试.... https://jsfiddle.net/x20ra1o1/2/ – Hackerman