N
Nuxt3mo ago
IamSebastn

Intercepting Routes

Hey dear NuxtCommunity! although I have experiences in React, I‘m pretty new to vue/nuxt. For a project of mine, I wanted to display a modal with it‘s own route (e.g localhost:3000/modal). Does someone already created so called intercepting routes and/or knows how to do it? Thanks at all in advance 🫶🏼
2 Replies
Fabian B.
Fabian B.3mo ago
Hey there! You can do this with nested routes: https://nuxt.com/docs/guide/directory-structure/pages#nested-routes The way it works is you have a parent page component that is displayed when the modal is closed. (in your case /). Then, when navigating to /modal , the child route gets loaded, which could open the modal.
IamSebastn
IamSebastn3mo ago
@Fabian B. Thanks buddy!