<div id="app"> <button @click="submit" :disabled="isDisable">点击</button> </div>
data(){ return{ isDisable:false } }
methods:{ submit(){ this.isDisable=true setTimeout(()=>{ this.isDisable=false //点击一次时隔两秒后才能再次点击 },2000) } }
效果:
点击之后按钮变灰,两秒之后可再次点击
注:小demo,不喜勿喷
--- The End
所有评论(0)