当前位置: 代码迷 >> 综合 >> vue中发送请求时防止按钮多次点击
  详细解决方案

vue中发送请求时防止按钮多次点击

热度:69   发布时间:2024-01-24 22:09:31.0
<el-button type="primary" :disabled="isDisable" @click="doctorAutograph">医生签字</el-button>export default {data() {return {isDisable:false,//防止医生签名多次提交};},methods:{async doctorAutograph(){this.isDisable = true;//点击后禁用该按钮;this.changeMedicinal = this.inferenceData[this.deductionIndex].prescData;const response = await autograph(this,this.disease,this.diseaseElement,this.drugState,this.inferenceTransferId,this.patientId,this.changeMedicinal,this.treat,this.visitId);const data = response.data;var that = this;if(response.code == 0){this.$message({message: '签名成功,继续开方即将切换的患者列表!',type: "success",duration: 2000});setTimeout(function () {that.$router.push({name: "PatientManagement",});},2000)}setTimeout(() => {this.isDisable = false;//响应后延迟几秒回复正常;}, 3000)}}
}

 

  相关解决方案