vue elementui 弹框确定后加上loading提示
this.$confirm("确认取消关联该园所?", "提示", {
confirmButtonText: "确定",//必填
cancelButtonText: "取消",//必填
type: "warning",//必填
beforeClose: (action, instance, done) => {
if (action === "confirm") {//必填
instance.confirmButtonLoading = true;
instance.confirmButtonText = "执行中...";
this.postRequest("/api/admin/agency/associateXXX", { //请求路径 postRequest post请求的方式可以超考原生的写法
schoolId:'',
relateSchoolId: id,
}).then(
(data) => {
if (data.status == "200") {
//业务代码
this.$message({
type: "success",
message: "取消关联成功!",
});
this.search();
//业务代码-End
//必要部分
done();
setTimeout(() => {
instance.confirmButtonLoading = false;
}, 300);
//必要部分-End
this.changeDialog = false; //业务代码
} else {
//必要部分
done();
setTimeout(() => {
instance.confirmButtonLoading = false;
}, 300);
//必要部分-End
this.changeDialog = false; //业务代码
}
}
);
} else {
done();
}
},
})
.then(() => {})
.catch(() => {});