vue 页面倒计时跳转

 页面提交成功之后,直接跳回原来页面,此处代码直接复制用就可以了

第一步:

<div>{{count}}</div>

第二步:
 created () {
    this.goGrdoupRecor();
  },
 methods: {
   //  3秒后进入群发记录
  goGrdoupRecor(){
    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:'/WorkPage/manualList',
        // })
        }
      },1000)
    }
  },
 
 

猜你喜欢

转载自www.cnblogs.com/maibao666/p/13201349.html