when I switch tabs, I will decide whether to switch tabs according to the user"s choice. The tabs use the tabs component of elemenui. I think there is a before-leave method in the document as shown in figure
.
my code:
this.$confirm("?", "", {
confirmButtonText: "",
cancelButtonText: "",
type: "warning"
}).then(() => {
return true;
}).catch(() => {
return false
});
returnfalse, when I choose to cancel, but this does not prevent switching, so I vaguely feel that I want to use this sentence in the document to prevent "returning Promise and being blocked by reject,." ,
but I really don"t know how to write it. Ask for advice