K
K
Konstantin B.2019-07-24 17:34:56
Vue.js
Konstantin B., 2019-07-24 17:34:56

Why renders the top route component instead of the child?

I'm writing a VueJS front
Started nesting routes inside each other to work with breadcrumbs. As a result, for some reason, the same component of the main route is shown on all child routes. What am I doing wrong?)
Here is the same piece of the route

{
            name: 'settings.segments.index',
            path: '/settings-segments',
            component: IndexSegmentComponent,
            meta: {
                breadcrumb: 'Сегменты'
            },
            children: [
                {
                    path: '/settings-segments/create',
                    name: 'settings.segments.create',
                    component: CreateSegmentComponent,
                    meta: {
                        breadcrumb: 'Новый сегмент'
                    },
                },
                {
                    path: '/settings-segments/:id',
                    name: 'settings.segments.show',
                    component: ShowSegmentComponent,
                    meta: {
                        breadcrumb: 'Просмотр сегмента'
                    },
                },
            ]
        },

Judging by the change of bread crumbs, the determination of routes is correct. But the IndexSegmentComponent component is always displayed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-07-24
@Kostik_1993

They probably forgot to add router-view to the IndexSegmentComponent.
UPD. Well, yes, it is. The dude was shy about something and rubbed the comment, but they (comments) are duplicated in the mail, so I restore:
Seriously. If you took the trouble to read the documentation , you would be aware that you should use separate router-view.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question