this.$confirm("存在未保存模板,是否切换模板!", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.$message({
type: "success",
message: "删除成功!",
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消操作",
});
});
方法一直进入catch中,这个问题主要是因为.then方法里代码出错导致的,我的问题是里面的接口请求出了问题导致的。
