解決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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM