How to define nested component at root url? #257
-
I use the path function to map a component called Short example: routesfolder: [
{
filePatterns: ["**/_page"],
extensions: [".vue"],
path(file) {
return (file.slice(file.lastIndexOf('src/pages') + 'src/pages'.length)
.replace("_page", "index")
}
},
{
filePatterns: ["**/_layout"],
extensions: [".vue"],
path(file) {
return (file.slice(file.lastIndexOf('src/pages') + 'src/pages'.length)
.replace("_layout", "")
}
}
]
Generated routes: export const routes = [
{
path: "/",
component: _page_0
},
{
path: "/home",
children: [
{
path: ""
component: () => import(...)
}
]
}
] What I'm trying to achieve: export const routes = [
{
path: "/",
component: _page_0,
children: [
{
path: "/home",
children: [
{
path: ""
component: () => import(...)
}
]
}
]
}
] I should add that I get the desired behaviour at any level except for at the root. |
Beta Was this translation helpful? Give feedback.
Answered by
PindaPixel
Nov 20, 2023
Replies: 1 comment
-
I found the answer: Output should be:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
PindaPixel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found the answer:
The return value of all but the root layout should start with a leading slash if they are to be children of the root url.
Output should be: