Reputation: 148
I would like to refresh a page (same effect as click Command+R on Mac OS) when navigating to that page.
For example:
I have "abc.com/login" for the Login page which will navigate to "abc.com/dashboard" for Dashboard after login successfully. At the moment, it navigates to the Dashboard without completely refresh the whole page.
I would like it to completely refresh everything. By "refresh", I mean it is the same as clicking Command+R on the browser.
Upvotes: 1
Views: 1595
Reputation: 5414
You can use vue built-in forceUpdate
function, like this:
vm.$forceUpdate()
or if it's inside the component, you can use
this.$forceUpdate();
References:
Upvotes: 0
Reputation: 3999
You can use something like this
window.location.href = "/dashboard?key=" + Math.random()
Instead of Math.random() something else can be used if required
Upvotes: 0
Reputation: 614
Try:
window.location.reload(true);
Passing true
to the reload function will force the page to reload from the server. Alternatively, pass false
to reload from cache.
This is vanilla javascript so it is not a vueJS only solution.
Upvotes: 0