I have a Nuxt project and for the SEO purpose, I need to reload the pages every time I do visit any page.
Is there any way I can do it on Routers
?
Currently, my app is with the default behavior of NUXT ” renders only the required components on visit”. But I need to completely reload the pages.
7
Answers
I do believe that reloading the page cleares (and re-initializes) your vuex store, if you are using that
I don’t know how to reload the page but I have a few suggestions that you could test
Suggestion 1
Wrap your page with a
v-if
. Then it wont render until you visit itSuggestion 2
Suggestion 3
Bind your component to a
key
And change that key whenever you need re-rendering
If you want to refresh the page manually you can call –
this.$router.app.refresh()
Try:
window.location.reload(true)
I had the same issue, but this solved it well, just watch changes in the $route() method then refresh appropriately in the
layouts/default.vue
file.In your layout nuxtjs, bind key property of router view to fullPath which always change on router change. It help rerender router:
If you want to refresh every page you move to..
Just use regular anchor tag <a href="/myRoute">
instead of <nuxt-link to="/myRoute">
Check this.