const handleDel = (tips = "", delAction, delParams) => {
ElMessageBox.confirm(`确定删除该${tips}吗?`, "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
beforeClose: (action, instance, done) => {
if (action === "confirm") {
// 开启按钮加载
instance.confirmButtonLoading = true;
// 删除接口
delAction(delParams)
.then((res: any) => {
if (res.code === 200) {
ElMessage.success("操作成功");
getList();
done();
}
})
.catch(() => {})
.finally(() => {
// 接口回调结束,关闭按钮加载
instance.confirmButtonLoading = false;
});
} else {
done();
}
},
}).catch(() => {});
};
【elementplus】给确认提示框的确认按钮增加加载状态的写法
最新推荐文章于 2024-08-02 10:39:07 发布