Vue.js Page Redirect after X delay seconds

Today, We want to share with you Vue.js Page Redirect after X delay seconds.In this post we will show you Vue.js Redirect to Another Page After 5 Seconds Example, hear for How can i redirect to other page using Vue.js we will give you demo and example for implement.In this post, we will learn about Redirect to another page after delay 5 seconds (some seconds) using Vue.js with an example.

Vue.js Page Redirect after X delay seconds

There are the Following The simple About Vue.js has only built-in directives Full Information With Example and source code.

Read Also:  How to Dynamic Populate Values in One HTML Dropdown List With Another Using Simple Javascript PHP?

As I will cover this Post with live Working example to develop Redirect page after delay using Vue.js, so the Vue this.$router.push in setTimeout is used for this example is following below.

<script>

  export default {
    created(){
      setTimeout( () => this.$router.push({ path: '/login'}), 5000);

    }
  }

</script>

Example 1:

setTimeout(function(){ window.location = "http://www.google.com"; },3000);

How to use setTimeout in Vue JS?

index.html

<!DOCTYPE html>
<html>
<head>
    <title>How to use setTimeout in Vue JS? - pakainfo.com</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
  
<div id="root">
    {{ inforamtion }}
</div>
  
</body>
   
<script type="text/javascript">
 new Vue({
    el: '#root',
    data: { 
          inforamtion:"Gretting, Please Wait...."
      },
      methods:{
        callFunction: function () {
            var v = this;
            setTimeout(function () {
                v.inforamtion = "Hi pakainfo Website, SetTimeout is working pakainfo fine.";
            }, 3000);
        }
    },
    mounted () {
      this.callFunction()
    }
});
</script>
</html>

Web Programming Tutorials Example with Demo

Read :

Read Also:  Installing laravel on windows wamp xampp

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about how to redirect to another page in Vue.js after 5 seconds?.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.