vue-element简单封装验证倒数,调用,清除
function getCodetimer(that,timer,show,count) {
that.show = true;
const TIME_COUNT = 60;
if (!that.timer) {
that.count = TIME_COUNT;
that.show = true;
that.timer = setInterval(() => {
console.log(“1”)
if (that.count > 0 && that.count <= TIME_COUNT) {
that.count–;
} else {
that.show = false;
clearInterval(that.timer);
that.timer = null;
}
}, 1000)
}
};
清除根据自己的情况来
调用