Replies: 2 comments 5 replies
-
You can define an own // from my [...slug].ts page
definePageMeta({
key: route => (route.params.slug as string[])[0], // Depend only on the first parameter
})
|
Beta Was this translation helpful? Give feedback.
5 replies
-
If anyone has same problem, as a workaround, instead of using export default defineNuxtConfig({
hooks: {
'pages:extend'(pages) {
pages.push({
name: 'slug-page',
path: '/:slug',
file: '~/pages/[slug].vue'
});
}
} Example: https://stackblitz.com/edit/nuxtframeworkdiscussions948-vxjwu4?file=nuxt.config.ts |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have defined dynamic routes using single regexp in
router.options.ts
and they all point to same component. Yet when navigating between these routes component is being recreated each time, not reused.How to force in nuxt3 to use same component, not recreate new one when navigating between routes with same component? Similarly as it is done on Vue/Router without nuxt.
Similar discussions where on previous nuxtjs version and setting key param on page component worked, but this doesn't work in nuxt 3.
Or as a workaround, it it somehow possible to prevent loading new route component through middleware, yet allowing changing the URL.
Any other ideas maybe? Thank you.
Beta Was this translation helpful? Give feedback.
All reactions