我如何在 sweet alert 中重定向到新的 window

How can i redirect to new window in sweet alert

如何在 sweet alert

中打开一个新 window 中的 url

您可以使用 "window.open(URL,name,specs,replace)" 在其他 window 中打开。示例:

swal({
  title: "Are you sure?",
  text: "You redirect in the new window in other page!",
  type: "warning",
  showCancelButton: true,
  confirmButtonClass: "btn-danger",
  confirmButtonText: "Yes, delete it!",
  cancelButtonText: "No, cancel plx!",
  closeOnConfirm: false,
  closeOnCancel: false
},
function(isConfirm) {
  if (isConfirm) {
    window.open("https://www.google.com");
  } else {
    window.open("https://www.yahoo.com");
  }
});

如果您想在 _blank 中打开,请使用:

window.open("https://www.google.com", '_blank');