vue button 多次點擊重復提交


//發表評論
sendComment () {
this.disabled = true
if (this.text == ''){
this.$message({
type:'error',
message:'輸入內容不能為空',
})
this.disabled = false
}else{
this.$post('/xx/xx/IdleGoodsComment',{
goods_id:this.$route.params.id,
content:this.text,
user_id:window.uId,
type:1
}).then((res) => {
if(res){
this.getDetail()
setTimeout(()=>{
this.disabled=false
this.getCommentList()
this.text = ''}
,2000)
this.disabled = true
}
})
}
}
實現原理:通過計時器講button屬性更改,點擊完之后講button屬性設置為disable
vue綁定button的disable屬性為:disabled:'變量名'


免責聲明!

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



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