Sometimes, we want to go back with Vue Router.
In this article, we’ll look at how to go back with Vue Router.
How to go back with Vue Router?
To go back with Vue Router, we can use the $router.go
method.
For instance, we write
<template>
<a @click="$router.go(-1)">back</a>
</template>
to add a link that calls $router.go
with -1 to go back to the previous route when we click it.
Conclusion
To go back with Vue Router, we can use the $router.go
method.