Answer the question
In order to leave comments, you need to log in
How else to pass name to the route object?
Guys, how to pass a route name from a component
, there are these ways:
export const routes = [
//{ path: '/', component: HomePage },
{ path: '/menu', component: MenuPage, children: [
{ path: '', component: CategoriesPage, name: 'Меню'},
{ path: ':categoryId', component: CategoryPage, children: [
{ path: '', component: ProductsPage },
{ path: ':productId', component: ProductPage }
] }
] },
{ path: '/profile', component: ProfilePage, name: 'Профиль' },
{ path: '/cart', component: CartPage, name: 'Корзина' },
{ path: '/promo', component: PromoPage, name: 'Акции' },
{ path: '/restourants', component: RestourantsPage, name: 'Рестораны' }
];
Answer the question
In order to leave comments, you need to log in
It doesn't seem like the right approach to try to change $route.name.
In CategoriesPage, most likely you get a list with categories, save this list in the store, i.e. you should have an object like:
categories:
[{id: 1, name: 'Категория 1'},
{id: 2, name: 'Категория 2'},
{id: 3, name: 'Категория 3'}]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question