How to go back to the previous page in Vue.js

in Code Write a comment

Learn how to programmatically navigate back without reloading the page in Vue.js.

In Vue.js you can take advantage of the Vue Router methods.


You can use router.go(n) method to programmatically navigate backwards or forward. It takes an integer as the only parameter that tells the method how many steps to go forward or backwards.

// go forward by one record, the same as history.forward()

// go forward by 3 records

To go back to the previous page use:


It will take use 1 step back, which is the same as history.back().

Hi, I'm Renat 👋


If you find this post useful, please let me know in the comments below. 
Renat Galyamov

Want to share this with your friends?

PS: Make sure you check other Vue.js tutorials, e.g. how to set a default value for an HTML <select> tag in Vue.js or Top 5 CSS frameworks for your Vue.js project (2019).

A collection of UI components for
Bootstrap 4/5 and Vue.js

Get now

Write a Comment