Skip to content

Commit

Permalink
do not normalize to if already a route in getMatchedComponents() (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 1, 2017
1 parent 90ba1cc commit 34b9abc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ export default class VueRouter {
this.go(1)
}

getMatchedComponents (to?: RawLocation): Array<any> {
const route = to
? this.resolve(to).route
getMatchedComponents (to?: RawLocation | Route): Array<any> {
const route: any = to
? to.matched
? to
: this.resolve(to).route
: this.currentRoute
if (!route) {
return []
Expand Down
2 changes: 1 addition & 1 deletion types/router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare class VueRouter {
go (n: number): void;
back (): void;
forward (): void;
getMatchedComponents (to?: RawLocation): Component[];
getMatchedComponents (to?: RawLocation | Route): Component[];
onReady (cb: Function, errorCb?: Function): void;
onError (cb: Function): void;
addRoutes (routes: RouteConfig[]): void;
Expand Down

0 comments on commit 34b9abc

Please sign in to comment.