I'm building a Nuxt application that has a list of products and clicking on one of them open a dedicated page of the product. It is working fine.
Structure is:
/pages/featured // directory of products
/pages/product/:id/:slug // Dedicated product page
Now I wish to add a new feature:
- I wish to keep the dedicated page of the product if clicked from a page that is not the directory of the products or if people land directly on it;
- I wish to open an almost full-screen dialog of the product on top of the directory if, obviously, clicked from the directory;
- Keep the routing change on dialogs.
A nice example of what I wish to achieve is the photo directory of Youpic.
A list of "products", visible entirely in a dialog with its internal navigation.
I'm looking at the various nuxt-routing and vue-router documentations to try developing it but I'm still far away from the solution.
This small portion of the code I see here looks pretty similar at what I need but I don't understand how should I correctly implement it and how to create my nuxt custom routing:
export default {
router: {
extendRoutes (routes, resolve) {
routes.push({
path: '/users/:id',
components: {
default: resolve(__dirname, 'pages/users'), // or routes[index].component
modal: resolve(__dirname, 'components/modal.vue')
},
chunkNames: {
modal: 'components/modal'
}
})
}
}
}