Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: named view support #6

Merged
merged 13 commits into from
Jun 28, 2022
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"testing.automaticallyOpenPeekView": "never"
"testing.automaticallyOpenPeekView": "never",
"prettier.enable": true
}
48 changes: 36 additions & 12 deletions e2e/__snapshots__/routes.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,48 @@ exports[`generates the routes 1`] = `
{
path: \\"/:path(.*)\\",
name: \\"/[...path]\\",
component: () => import('/routes/[...path].vue'),
components: {
default: () => import('/routes/[...path].vue')
},
/* no children */
},
{
path: \\"/about\\",
name: \\"/about\\",
component: () => import('/routes/about.vue'),
components: {
default: () => import('/routes/about.vue')
},
/* no children */
},
{
path: \\"/\\",
name: \\"/\\",
component: () => import('/routes/index.vue'),
components: {
default: () => import('/routes/index.vue')
},
/* no children */
},
{
path: \\"/users.new\\",
name: \\"/users.new\\",
component: () => import('/routes/users.new.vue'),
components: {
default: () => import('/routes/users.new.vue')
},
/* no children */
},
{
path: \\"/users\\",
name: \\"/users\\",
component: () => import('/routes/users.vue'),
components: {
default: () => import('/routes/users.vue')
},
children: [
{
path: \\":id\\",
name: \\"/users/[id]\\",
component: () => import('/routes/users/[id].vue'),
components: {
default: () => import('/routes/users/[id].vue')
},
/* no children */
}
],
Expand All @@ -47,13 +59,17 @@ exports[`generates the routes 1`] = `
{
path: \\":id\\",
name: \\"/articles/[id]\\",
component: () => import('/routes/articles/[id].vue'),
components: {
default: () => import('/routes/articles/[id].vue')
},
/* no children */
},
{
path: \\":slugs+\\",
name: \\"/articles/[slugs]+\\",
component: () => import('/routes/articles/[slugs]+.vue'),
components: {
default: () => import('/routes/articles/[slugs]+.vue')
},
/* no children */
}
],
Expand All @@ -66,13 +82,17 @@ exports[`generates the routes 1`] = `
{
path: \\":doc?\\",
posva marked this conversation as resolved.
Show resolved Hide resolved
name: \\"/optional/[[doc]]\\",
component: () => import('/routes/optional/[[doc]].vue'),
components: {
default: () => import('/routes/optional/[[doc]].vue')
},
/* no children */
},
{
path: \\":docs*\\",
name: \\"/optional/[[docs]]+\\",
component: () => import('/routes/optional/[[docs]]+.vue'),
components: {
default: () => import('/routes/optional/[[docs]]+.vue')
},
/* no children */
}
],
Expand All @@ -90,7 +110,9 @@ exports[`generates the routes 1`] = `
{
path: \\"\\",
name: \\"/nested/folder/\\",
component: () => import('/routes/nested/folder/index.vue'),
components: {
default: () => import('/routes/nested/folder/index.vue')
},
/* no children */
},
{
Expand All @@ -106,7 +128,9 @@ exports[`generates the routes 1`] = `
{
path: \\"\\",
name: \\"/nested/folder/should/work/\\",
component: () => import('/routes/nested/folder/should/work/index.vue'),
components: {
default: () => import('/routes/nested/folder/should/work/index.vue')
},
/* no children */
}
],
Expand Down
4 changes: 3 additions & 1 deletion playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ route.name === '/about'
</div>
</header>

<!-- <RouterView /> -->
<RouterView />
<hr />
<RouterView name="named" />
posva marked this conversation as resolved.
Show resolved Hide resolved
</template>
5 changes: 5 additions & 0 deletions playground/src/routes/index@named.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<main>
<h1>Home - named view</h1>
</main>
</template>