一、防抖
简单化有效的处理如下:
async handleAddDeploy() {
this.$refs.formLabelAlign.validate(async valid => {
if (!valid) return false;
if (this.editLoading) return;
this.editLoading = true;
if (this.addFlag) {
// 新增
this.formLabelAlign = dataAddDefalutTime(this.formLabelAlign);
await this.addDeploy();
} else if (this.updateFlag) {
// 修改
await this.updateDeploy();
} else if (this.reviewFlag) {
// 审核
await this.reviewDeploy();
} else if (this.apperoveFlag) {
// 审批
await this.apperoveDeploy();
}
this.editLoading = false;
});
},
async addDeploy() {
this.handleSetCommentData();
const res = await add(this.formLabelAlign);
if (res.code === 200) {
this.$message.success("新增成功");
this.dialogVisible = false;
this.dispatcherData = [];
this.reviewerUserData = [];
this.approverUserData = [];
this.$emit("getPageList");
}
},
2、节流
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)