[英]How can I display a confirmation alert before redirecting?
How can I display a swal fire alert before redirecting?如何在重定向之前显示 swal 火灾警报?
<a :href="`/public/project/sendalert/${project.id}`">{project.first_name+' '+project.last_name}} @click="Alert"</a></strong></span>
alert() {
window.Swal.fire({
title: 'Are you sure?',
text: "Are you sure?"
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'YES!',
})
},
1.click event should be put into the properties. 1.click事件应该放入属性中。
<a @click="Alert">{project.first_name+' '+project.last_name}}</a></strong></span>
2.execute the redirect on the confirm action. 2.在确认动作上执行重定向。
alert() {
window.Swal.fire({
title: 'Are you sure?',
text: "Are you sure?",
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'YES!',
}, function (isConfirm) {
if (isConfirm) {
location.href = "...";
}
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.