NuxtLink and Vue router duplicate routes


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?

>Solution :

Just remove last "/".

category/${slug} <== OK

category/${slug}/ <== Not OK

/category/${slug} <== OK

Leave a Reply Cancel reply