NUXT3 NuxtLink redirecting to wrong url

51 Views Asked by At

I'm using NUXT3 When the URL is localhost:3000/Eventik/events and I click on a link

 <NuxtLink class="list-group-item" :to="/events/edit/${event.eventId}">{{ $t('edit') }}</NuxtLink> 

inside the page,

it works correctly and goes to the address localhost:3000/Eventik/events/edit/1.

However, when the URL is localhost:3000/Eventik/events/ and I click on the same link, it takes me to the wrong URL localhost:3000/Eventik/events/events/edit/1.

I tried

 <NuxtLink class="list-group-item" :to="edit/${event.eventId}">{{ $t('edit') }}</NuxtLink> 

when the URL is localhost:3000/Eventik/events the result -> localhost:3000/Eventik/edit/1 and it's not correct.

and when the URL islocalhost:3000/Eventik/events or localhost:3000/Eventik/events/ with

 <NuxtLink class="list-group-item" :to="/edit/${event.eventId}">{{ $t('edit') }}</NuxtLink> 

-> localhost:3000/edit/1

0

There are 0 best solutions below