vue中倒计时3秒后跳转页面
<script>export default {data(){return {count:"",//倒计时 } }},created(){this.threeGo()},methods: {//3秒后进入跳转页面threeGo(){const TIME...
·
<script>
export default {
data(){
return {
count:"",//倒计时
}
}
},
created(){
this.threeGo()
},
methods: {
//3秒后进入跳转页面
threeGo(){
const TIME_COUNT = 3;
if(!this.timer){
this.count = TIME_COUNT;
this.show = false;
this.timer = setInterval(()=>{
if(this.count > 0 && this.count <= TIME_COUNT){
this.count--;
}else{
this.show = true;
clearInterval(this.timer);
this.timer = null;
//跳转的页面写在此处
this.$router.push({
path: ''
});
}
},1000)
}
},
}
</script>
更多推荐
已为社区贡献1条内容
所有评论(0)