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.

Read Also:  Laravel Update Multiple Records using Laravel 5.8

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.

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:  FIX 500 internal server error laravel

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.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  DataTables Pagination Server-side Processing using PHP and MySQL
  2. Read Also:  Simple AngularJS Shopping Cart Application
  3. Read Also:  OrderBy Filter using Angular Example
  4. Read Also:  Vue JS Radio Buttons - Use Onlick or Onchange Event?
  5. Read Also:  How to deploy VUEJS app in Tomcat?
  6. Read Also:  jQuery Deleting Record from MySQL Table Row in Ajax
  7. Read Also:  Magento Create custom Database Table with Module
  8. Read Also:  PHP Vue.js Live Search Box Using MySQL
  9. Read Also:  Simple AngularJS Shopping Cart Application
  10. Read Also:  DataTables Pagination Server-side Processing using PHP and MySQL
CLOSEX