Skip to content

Commit 810e782

Browse files
AdminAdmin
Admin
authored and
Admin
committed
perf(guard): Add a tool function to handle the logic of TargetRouterViewDepth
1 parent 7780592 commit 810e782

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: src/util/route.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export function handleRouteEntered (route: Route) {
150150
}
151151
}
152152

153-
export function getTargetRouterViewDepth (target) {
153+
export function getTargetRouterViewDepth (target: any) {
154154
return target && target.$vnode && target.$vnode.data ? target.$vnode.data.routerViewDepth
155155
: null
156156
}

Diff for: types/router.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,13 @@ interface RouteConfigMultipleViews extends _RouteConfigBase {
354354
}
355355

356356
export type RouteConfig = RouteConfigSingleView | RouteConfigMultipleViews
357+
export type VueInstance = Dictionary<Vue>
357358

358359
export interface RouteRecord {
359360
path: string
360361
regex: RegExp
361362
components: Dictionary<Component>
362-
instances: Dictionary<Vue>
363+
instances: VueInstance
363364
name?: string
364365
parent?: RouteRecord
365366
redirect?: RedirectOption
@@ -380,7 +381,7 @@ export interface RouteRecord {
380381
export interface RouteRecordPublic {
381382
path: string
382383
components: Dictionary<Component>
383-
instances: Dictionary<Vue>
384+
instances: VueInstance
384385
name?: string
385386
redirect?: RedirectOption
386387
meta: any

0 commit comments

Comments
 (0)