]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
chore: more
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 25 Jul 2025 12:35:32 +0000 (14:35 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 25 Jul 2025 12:35:32 +0000 (14:35 +0200)
packages/experiments-playground/src/pages/nested/a.vue [new file with mode: 0644]
packages/experiments-playground/src/pages/profiles/(list).vue [new file with mode: 0644]
packages/experiments-playground/src/pages/profiles/+layout.vue [new file with mode: 0644]
packages/experiments-playground/src/router/index.ts

diff --git a/packages/experiments-playground/src/pages/nested/a.vue b/packages/experiments-playground/src/pages/nested/a.vue
new file mode 100644 (file)
index 0000000..2190a63
--- /dev/null
@@ -0,0 +1,7 @@
+<script setup lang="ts"></script>
+
+<template>
+  <main>
+    <h2>Nested A</h2>
+  </main>
+</template>
diff --git a/packages/experiments-playground/src/pages/profiles/(list).vue b/packages/experiments-playground/src/pages/profiles/(list).vue
new file mode 100644 (file)
index 0000000..d32da7e
--- /dev/null
@@ -0,0 +1,7 @@
+<script setup lang="ts"></script>
+
+<template>
+  <main>
+    <h2>List</h2>
+  </main>
+</template>
diff --git a/packages/experiments-playground/src/pages/profiles/+layout.vue b/packages/experiments-playground/src/pages/profiles/+layout.vue
new file mode 100644 (file)
index 0000000..db832bb
--- /dev/null
@@ -0,0 +1,9 @@
+<script setup lang="ts"></script>
+
+<template>
+  <div>
+    <h1>Profiles</h1>
+
+    <RouterView />
+  </div>
+</template>
index 64db4029d70b06c1bd3d0b67afe34f2e88933b4b..5bc8c3ab2bb0f0dcf26b7d69ea64a62decc7aca6 100644 (file)
@@ -12,8 +12,8 @@ import type {
 } from 'vue-router/experimental'
 import PageHome from '../pages/(home).vue'
 
-type ExtractMatcherQueryParams<T> =
-  T extends MatcherPatternQuery<infer P> ? P : never
+// type ExtractMatcherQueryParams<T> =
+//   T extends MatcherPatternQuery<infer P> ? P : never
 
 // type CombineMatcherParams<T extends readonly MatcherPatternQuery[]> =
 //   T extends readonly [infer First, ...infer Rest]
@@ -95,6 +95,7 @@ const ANY_HASH_PATTERN_MATCHER: MatcherPatternHash<// hash could be named anythi
 }
 
 const r_group = normalizeRouteRecord({
+  // cannot have a name because it's a group
   meta: {
     fromGroup: 'r_group',
   },
@@ -115,13 +116,23 @@ const r_about = normalizeRouteRecord({
   components: { default: () => import('../pages/about.vue') },
 })
 
-const r_profile_layout = normalizeRouteRecord({
-  components: {},
+const r_profiles_layout = normalizeRouteRecord({
+  // cannot have a name because it's a layout and can't be matched (no path, query, or hash)
+  // name: 'profile',
+  // path: new MatcherPatternPathStatic('/profile'),
+  components: { default: () => import('../pages/profiles/+layout.vue') },
   meta: {
     layout: 'profile',
   },
 })
 
+const r_profiles_list = normalizeRouteRecord({
+  name: 'profiles-list',
+  components: { default: () => import('../pages/profiles/(list).vue') },
+  path: new MatcherPatternPathStatic('/profiles'),
+  parent: r_profiles_layout,
+})
+
 const r_nested = normalizeRouteRecord({
   name: 'nested',
   components: { default: () => import('../pages/nested.vue') },
@@ -142,5 +153,6 @@ export const router = experimental_createRouter({
     r_about,
     r_nested,
     r_nested_a,
+    r_profiles_list,
   ]),
 })