M
M
Michael2018-06-12 11:49:31
JavaScript
Michael, 2018-06-12 11:49:31

How to navigate back in vue router?

Good day.
I use routes in vue app.
There is a question how to make transition back when the user presses back in the browser?
if you go to any url and click back, the url changes, but the page remains the same (the component does not change) or is empty.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Koteezy, 2018-06-12
@Koteezy

If you are trying to navigate to the same route ( /users/1 > /users/2 ) use the BeforeRouteUpdate hook and update the data in it.

A
Alexander Pushkarev, 2018-06-12
@AXP-dev

<router-link :to="-1">
<a @click="$router.go(-1)">back</a>

method() {
   this.$router.go(-1)
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question