You can use npm i sweetalert2
like:
import Swal from "sweetalert2"; import axios from "axios";
onDeleteClick( pk) {
Swal.fire({
text :"Are you sure?,
title: "You won't be able to ,
type: "question",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: Yes!,
cancelButtonText: No!
}).then(result => {
if (result.value) {
axios
.delete(
`api ,
)
.then(res => {
Swal.fire({
title: "Deleted",
type: "success",
text: " Deleted Successfully !!",
showConfirmButton: false,
timer: 2000
});
})
.catch(err => {
console.log(err);
Swal.fire({
title: " Deleted",
type: "error",
text: "Error While deleting ??",
timer: 3000
});
});
}
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.