N
Nuxtβ€’10mo ago
sparkletets

Reload page when nuxt-link 'to' prop is the same as current path?

This feels like such a silly, simple problem. I have never run into this in past Nuxt/Vue projects, must be doing something wrong. If a user (for example) clicks a link which leads to the same page as they are currently on, I want to trigger a reload of the page's components, as to simulate a page reload. this is my app.vue: <template> <div class="min-h-screen w-full | bg-white"> <HeaderNavBar /> <main> <NuxtPage :page-key="(route) => route.fullPath" /> </main> <Footer /> </div> </template> Surely the solution is not to put a @click listener on every single nav link? πŸ˜†
1 Reply
IsraelOrtuno
IsraelOrtunoβ€’10mo ago
you can define your own NuxtLink component and define your behaviour there only once https://nuxt.com/docs/api/components/nuxt-link#custom-link-component
Nuxt
Β· Nuxt Components
Nuxt provides component to handle any kind of links within your application.
Want results from more Discord servers?
Add your server