Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the equivalent window.location.href for vue router

I want to redirect to a page in my spa after an action in my small vue app. If I
do this with window.location.href = "/subpage" the page refreshes and I lose
cached data from my simple storage management.

The goal is to redirect without refreshing.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use Vue router, and use the router-link component.

<router-link to="/subpage">Sub page</router-link>

Or dynamically via javascript.

this.$router.push('/subpage');
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading