vue 點選倒計時 ajax 封裝
阿新 • • 發佈:2018-11-30
方法:function(){ var that = this; if (that.time == 0) { that.disabled = false; that.text ="點選獲取"; that.time =120; return; } else { that.disabled = true; that.text= that.time + "s"; that.time--; } setTimeout(function () { that.setTime(); }, 1000); }, SendMsg:function(){ var that = this; Comm.runebws("URL",data,"POST",function(result){ if(result.code==0){ that.setTime(); //重新開始計時 }else{ return } },function(e){ if(e&&e.message){ }else{ return } },1); }