Answer the question
In order to leave comments, you need to log in
Concise routing in vue?
How can vk-like routing be implemented?
That is, site.ru/id*** = the Profile component, site.ru/group*** = the Group component, and the main page changes depending on whether the user is authorized. That is, if authorized, then site.ru = Dashboard, and if not, then Landing.
At the moment, everything is built on a very deep nesting, which is inconvenient and ugly.
Answer the question
In order to leave comments, you need to log in
How can vk-like routing be implemented?
That is, site.ru/id*** = Profile component, site.ru/group*** = Group component
new Router({
// ...
routes: [
{
path: '/(id):id',
name: 'Profile',
component: Profile,
},
{
path: '/(group):groupId',
name: 'Group',
component: Group,
},
],
});
// Home.vue
<Dashboard v-if="isAuth" />
<Landing v-else />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question