<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>

 

Logo

前往低代码交流专区

更多推荐