SoFunction
Updated on 2025-04-05

Vue implementation jumps to the new page code after a few seconds

I won't say much nonsense, let's just read the code~

<template>
  <div @click="clickJump()">submit</div>
</template>
<script>
export default {
  data(){
    return {
      count:"",//Countdown    }
  }
}, 
mounted(){  
},
 
methods: {
 //In a few seconds, enter the jump page  clickJump(){
    const timejump = 1;
    if(!){
       = timejump ;
       = false;
       = setInterval(()=>{
      if( > 0 &&  <= timejump ){
        --;
      }else{
         = true;
        clearInterval();
         = null;
        //The page you jumped is written here        this.$({path: '/address'});
      }
     },100)
    }
  },
}
</script>

Supplementary knowledge:vue sets delay

Be sure to create a timer, and then clear the timer's delay before calling it

clearTimeout(); //Clear delay execution 
 = setTimeout(()=>{  //Set delay execution  ('ok');
},1000);

The above vue code will jump to the new page after a few seconds is implemented. This is all the content I share with you. I hope you can give you a reference and I hope you can support me more.