Skip to content

Commit df44d89

Browse files
committed
fix(vue2): route not having active tag, closes #1738
1 parent d4718a3 commit df44d89

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/app-backend-vue2/src/plugin.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ const DARK = 0x666666
284284

285285
function formatRouteNode (router, route, parentPath: string, filter: string): CustomInspectorNode {
286286
const node: CustomInspectorNode = {
287-
id: parentPath + route.path,
287+
id: route.path.startsWith('/') ? route.path : `${parentPath}/${route.path}`,
288288
label: route.path,
289289
children: route.children?.map(child => formatRouteNode(router, child, route.path, filter)).filter(Boolean),
290290
tags: [],
@@ -308,8 +308,7 @@ function formatRouteNode (router, route, parentPath: string, filter: string): Cu
308308
})
309309
}
310310

311-
const currentPath = router.currentRoute.matched.reduce((p, m) => p + m.path, '')
312-
if (node.id === currentPath) {
311+
if (node.id === router.currentRoute.path) {
313312
node.tags.push({
314313
label: 'active',
315314
textColor: WHITE,

0 commit comments

Comments
 (0)