close

[Solved] Vue Router this.$router.push not working on methods

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Vue Router this.$router.push not working on methods in vuejs. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How To Solve Vue Router this.$router.push not working on methods Error ?

  1. How To Solve Vue Router this.$router.push not working on methods Error?

    To Solve Vue Router this.$router.push not working on methods Error I Just changed the method this.$router.push() from my code, to this.$router.go('/').

  2. Vue Router this.$router.push not working on methods

    To Solve Vue Router this.$router.push not working on methods Error I Just changed the method this.$router.push() from my code, to this.$router.go('/').

Solution 1

You have to push to a name or path Try this:

this.$router.push({ path: '/' })
this.$router.push({ name: 'Home' })

Solution 2

Solved, I changed the method this.$router.push() from my code, to this.$router.go('/').

Solution 3

In my case, I found that my beforeRouteUpdate does not execute next() method

Bad:

beforeRouteUpdate(to, from, next) {
  /*
  something...
  */
}

Good:

beforeRouteUpdate(to, from, next) {
  /*
  something...
  */

  next() // DO IT!
}

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment