11<script setup lang="ts">
2- import { nextTick } from ' vue'
3-
42definePageMeta ({
53 icon: ' carbon-tree-view-alt' ,
64 title: ' Pages' ,
@@ -20,21 +18,15 @@ const layouts = useLayouts()
2018
2119const routes = useMergedRouteList ()
2220
23- const middleware = computed (() => {
24- return serverApp .value ?.middleware || []
25- })
26-
21+ const middleware = computed (() => serverApp .value ?.middleware || [])
2722const routeInput = ref (' ' )
2823
29- until ( route ). toBeTruthy (). then (( v ) => {
30- routeInput . value = v . path
31- })
24+ onMounted (( ) => {
25+ if ( route . value )
26+ routeInput . value = route . value . path
3227
33- until (router ).toBeTruthy ().then ((v ) => {
34- v .afterEach (() => {
35- nextTick (() => {
36- routeInput .value = route .value .path
37- })
28+ router .value ?.afterEach ((to ) => {
29+ routeInput .value = to .fullPath
3830 })
3931})
4032
@@ -44,13 +36,12 @@ async function navigate() {
4436}
4537
4638const routeInputMatched = computed (() => {
47- if (routeInput .value === route .value .path )
48- return []
4939 return router .value .resolve (routeInput .value || ' /' ).matched
5040})
5141
5242function navigateToRoute(path : string ) {
5343 router .value .push (path )
44+ routeInput .value = path
5445}
5546 </script >
5647
@@ -85,18 +76,23 @@ function navigateToRoute(path: string) {
8576 </div >
8677 </div >
8778 <NSectionBlock
88- v-if =" routeInputMatched.length"
8979 icon =" carbon-tree-view"
9080 text =" Matched Routes"
9181 :padding =" false"
9282 >
93- <RoutesTable
94- :pages =" routeInputMatched"
95- :layouts =" layouts || []"
96- :matched =" []"
97- :matched-pending =" routeInputMatched"
98- @navigate =" navigateToRoute"
99- />
83+ <div min-h-14 >
84+ <RoutesTable
85+ v-if =" routeInputMatched.length"
86+ :pages =" routeInputMatched"
87+ :layouts =" layouts || []"
88+ :matched =" route.matched"
89+ :matched-pending =" routeInputMatched"
90+ @navigate =" navigateToRoute"
91+ />
92+ <div v-else class =" py-4 text-center" >
93+ <span op50 >No routes matched</span >
94+ </div >
95+ </div >
10096 </NSectionBlock >
10197 <NSectionBlock
10298 icon =" carbon-tree-view-alt"
0 commit comments