data() {
return {
title: "支付结果",
count: "" //倒计时
};
},
created() {
this.threeGo();
},
methods: {
threeGo() {
const TIME_COUNT = 3;
if (!this.timer) {
this.count = TIME_COUNT;
this.show = false;
this.timer = setInterval(() => {
if (this.count > 1 && this.count <= TIME_COUNT) {
this.count--;
} else {
this.show = true;
clearInterval(this.timer);
this.timer = null;
//跳转的页面写在此处
}
}, 1000);
}
}
}
功能点:3秒倒计时自动跳转指定页面
最新推荐文章于 2022-05-07 18:33:54 发布