Home > OS >  NuxtLink and Vue router duplicate routes
NuxtLink and Vue router duplicate routes

Time:12-27

I use nuxt 3

I have a navigation bar, it has NuxtLink with the attribute :to.

Links have a dynamic route category/${slug}/

The problem is that the :to attribute does not overwrite the current navigation, but adds it to the end of the current one, like that category/${slug}/category/${slug}/

If I use the usual to attribute, then everything is fine.

Why is this happening and how to fix it?

CodePudding user response:

Just remove last "/".

`category/${slug}` // OK
`category/${slug}/` // Not OK
`/category/${slug}` // OK
  • Related