2
2
import type { RouterInfo } from ' @vue/devtools-kit'
3
3
import { VueInput } from ' @vue/devtools-ui'
4
4
import { DevToolsMessagingEvents , onDevToolsConnected , rpc } from ' @vue/devtools-core'
5
- import type { RouteLocationNormalizedLoaded , RouteRecordNormalized } from ' vue-router'
5
+ import type { RouteLocationNormalizedLoaded , RouteMeta , RouteRecordNormalized } from ' vue-router'
6
+ import { Pane , Splitpanes } from ' splitpanes'
6
7
7
8
const routeInput = ref (' ' )
8
9
const currentRoute = ref <RouteLocationNormalizedLoaded | null >(null )
@@ -16,6 +17,8 @@ const routeInputMatched = computed(() => {
16
17
17
18
const routes = ref <RouteRecordNormalized []>([])
18
19
20
+ const selectedMeta = ref <RouteMeta >()
21
+
19
22
function init(data : RouterInfo ) {
20
23
routes .value = data .routes
21
24
currentRoute .value = data .currentRoute as RouteLocationNormalizedLoaded
@@ -54,7 +57,7 @@ onUnmounted(() => {
54
57
55
58
<template >
56
59
<div block h-screen of-auto >
57
- <div h-full of-auto >
60
+ <div h-full class = " grid grid-rows-[auto_1fr] " >
58
61
<div border =" b base" flex =" ~ col gap1" px4 py3 >
59
62
<div >
60
63
<template v-if =" false " >
@@ -95,20 +98,28 @@ onUnmounted(() => {
95
98
@navigate="navigateToRoute"
96
99
/>
97
100
</SectionBlock> -->
98
- <SectionBlock
99
- icon =" i-carbon-tree-view-alt"
100
- text =" All Routes"
101
- :description =" `${routes.length} routes registered in your application`"
102
- :padding =" false"
103
- >
104
- <RoutesTable
105
- v-if =" routes.length"
106
- :pages =" routes"
107
- :matched =" currentRoute?.matched ?? []"
108
- :matched-pending =" routeInputMatched"
109
- @navigate =" navigateToRoute"
110
- />
111
- </SectionBlock >
101
+ <Splitpanes class =" of-hidden" >
102
+ <Pane size =" 70" class =" of-auto!" >
103
+ <SectionBlock
104
+ icon =" i-carbon-tree-view-alt"
105
+ text =" All Routes"
106
+ :description =" `${routes.length} routes registered in your application`"
107
+ :padding =" false"
108
+ >
109
+ <RoutesTable
110
+ v-if =" routes.length"
111
+ :pages =" routes"
112
+ :matched =" currentRoute?.matched ?? []"
113
+ :matched-pending =" routeInputMatched"
114
+ @navigate =" navigateToRoute"
115
+ @select-meta =" (meta: RouteMeta) => selectedMeta = meta"
116
+ />
117
+ </SectionBlock >
118
+ </Pane >
119
+ <Pane v-if =" !!selectedMeta" size =" 30" class =" of-auto!" >
120
+ <RouteMetaDetail :meta =" selectedMeta" @close =" selectedMeta = undefined" />
121
+ </Pane >
122
+ </Splitpanes >
112
123
</div >
113
124
</div >
114
125
</template >
0 commit comments