Reputation: 1860
I am using vue 2. I have registered routes. Two routes are memberships
and memberships/:id
.
When I use:
this.$router.push({ path: 'memberships'} );
after this any this.$router.push
results in appending to
http://localhost:8000/memberships/bronze
http://localhost:8000/memberships/silver
and http://localhost:8000/memberships/shop
in place of http://localhost:8000/shop
and http://localhost:8000/memberships/deals
in place of http://localhost:8000/deals
Upvotes: 2
Views: 3832
Reputation: 63119
Use a leading slash in all of your base route paths:
this.$router.push({ path: '/memberships' });
Do this in the base route definitions too. Also you can name your routes and push by name:
this.$router.push({ name: 'memberships'} );
Upvotes: 4