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() router.go(1) // go forward by 3 records router.go(3)
To go back to the previous page use:
It will take use 1 step back, which is the same as
If you find this post useful, please let me know in the comments below.
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).
Incoming search terms: