Answer the question
In order to leave comments, you need to log in
How do children work in the Vue router?
All routes work except the last one (example.com/news/create) - How to write a route correctly to make it work.
{
path: '',
component: Main,
children: [
{
path: '',
name: 'index-page',
component: Index
},
{
path: 'homes',
name: 'homes-list',
component: Homes
},
{
path: 'news',
name: 'news-index',
component: News,
children: [
{
path: 'news/create',
name: 'news-create',
component: NewsCreate,
}
]
},
]
},
Answer the question
In order to leave comments, you need to log in
Replace:
children: [
{
path: 'news/create',
name: 'news-create',
component: NewsCreate,
}
]
children: [
{
path: 'create',
name: 'news-create',
component: NewsCreate,
}
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question