Skip to content

Commit

Permalink
fix(vue2): route not having active tag, closes #1738
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Feb 15, 2022
1 parent d4718a3 commit df44d89
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/app-backend-vue2/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ const DARK = 0x666666

function formatRouteNode (router, route, parentPath: string, filter: string): CustomInspectorNode {
const node: CustomInspectorNode = {
id: parentPath + route.path,
id: route.path.startsWith('/') ? route.path : `${parentPath}/${route.path}`,
label: route.path,
children: route.children?.map(child => formatRouteNode(router, child, route.path, filter)).filter(Boolean),
tags: [],
Expand All @@ -308,8 +308,7 @@ function formatRouteNode (router, route, parentPath: string, filter: string): Cu
})
}

const currentPath = router.currentRoute.matched.reduce((p, m) => p + m.path, '')
if (node.id === currentPath) {
if (node.id === router.currentRoute.path) {
node.tags.push({
label: 'active',
textColor: WHITE,
Expand Down

0 comments on commit df44d89

Please sign in to comment.