其他分享
首页 > 其他分享> > 解决vue 按钮多次点击重复提交问题

解决vue 按钮多次点击重复提交问题

作者:互联网

<Button type="primary" @click="bookok" :disabled="isDisable">确定</Button>
<script>
    export default {
         return {
                isDisable: false,//表单重复提交
          },
          methods: {
           bookok() {
	    	  this.isDisable = true  //开始可以点击
		      this.post("api/student/Bespeak/getBespeak", {
		          'stuId':this.rowData.stuId,
			        'bespeakId':this.rowData.bespeakId,
			        'courseId':this.courseId
		      }).then(data => {
		      	 this.isDisable = false;//执行请求后就不能点击了
		        if (data.code == 0) {
		        	this.isShow = true
		        	this.$Message.success("预约成功");
							this.btnSearch() 
		        } else {
		          this.$Message.error(data.msg);
		        }
		      });
	    },
          } 
    }
</script>

标签:vue,false,isDisable,courseId,bespeakId,点击,按钮,data
来源: https://www.cnblogs.com/apanlog/p/15516812.html