如何更改 sweetalert 按钮文本?

How to change sweetalert button text?

我想将 'Ok' 按钮更改为 'Select patient',将 'Cancel' 更改为 'Speed case'。我该怎么做?

swal({
  text: "Start new case by",
  buttons: true,
  confirmButtonText: "Select Patient?",
  cancelButtonText: "Speed Case?",      
});
swal({
  text: "Start new case by",
  buttons: ["Select Patient?", "Speed Case?"],
});

答案在这里

 swal({
            title: "Are you sure?",
            text: "you want to Cancel Operation!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: '#DD6B55',
            confirmButtonText: 'Yes, I am sure!',
            cancelButtonText: "No, cancel it!",
            closeOnConfirm: false,
            closeOnCancel: false
        },

希望对你有用

swal({
    title: 'Are you sure?',
    text: 'Once deleted, you will not be able to recover this imaginary file!',
    icon: 'warning',
    buttons: true,
    dangerMode: true,
    buttons: ['yes, forsure', 'no, thanks']
});

您可以使用这种方法

swal({
  text: "Start new case by",
  showCancelButton: true,
  confirmButtonText: "Select Patient?",
  cancelButtonText: "Speed Case?",     
  title: 'Title'
});