Hello!

程序员给自己留条后路

亲爱的朋友

专业挖坑

vue 点击倒计时 ajax 封装

方法: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);
            }

 

posted @ 2018-11-30 15:52  湾子大郊亭  阅读(175)  评论(0编辑  收藏  举报