this.getCount(
"detailShow",
"detailDisabled",
"detailTimer",
"detailCount"
);
//10s倒计时
getCount: function(show, disabled, timer, count) {
const TIME_COUNT = 10;
if (!this[timer]) {
this[count] = TIME_COUNT;
this[show] = false;
this[disabled] = true;
this[timer] = setInterval(() => {
if (this[count] > 0 && this[count] <= TIME_COUNT) {
this[count]--;
} else {
this[show] = true;
this[disabled] = false;
clearInterval(this[timer]);
this[timer] = null;
}
}, 1000);
}
}
10s倒计时vue
最新推荐文章于 2022-02-28 00:43:47 发布