Frallen
Frallen

Reputation: 433

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?

Upvotes: 1

Views: 316

Answers (1)

Mises
Mises

Reputation: 4603

Just remove last "/".

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

Upvotes: 1

Related Questions