原生JS
countDown: function(){ //倒计时 var yzmBtns = document.getElementById("id"); var waits=60; yzmBtns.setAttribute("disabled",true) yzmBtns.innerText=waits+'s'; var timers = setInterval(() => { if(waits <= 1){ waits=1; yzmBtns.innerText="重新验证"; yzmBtns.removeAttribute("disabled") clearTimeout(timers) }else{ waits--; yzmBtns.innerText=waits+'s'; } }, 1000) }