return {
count: '', //倒计时时间
isShowTimeHeader:1,//三秒后需要改变的值
}
methods: {
countDown() {
const TIME_COUNT = 3;
if (!this.timer) {
this.count = TIME_COUNT;
this.timer = setInterval(() => {
if (this.count > 1 && this.count <= TIME_COUNT) {
//限制倒计时区间
this.count--;
} else {
clearInterval(this.timer); //删除定时器
this.timer = null;
//三秒后关闭(三秒后需要进行的操作)
this.isShowTimeHeader = 0;
}
}, 1000);
}
},
}
created() {
this.countDown(); // 倒计时
},