@@ -54,7 +54,7 @@ export function createMatcher (
54
54
redirectedFrom ?: Location
55
55
) : Route {
56
56
const location = normalizeLocation ( raw , currentRoute , false , router )
57
- const { name } = location
57
+ const { name , path } = location
58
58
59
59
if ( name ) {
60
60
const record = nameMap [ name ]
@@ -80,18 +80,17 @@ export function createMatcher (
80
80
81
81
location . path = fillParams ( record . path , location . params , `named route "${ name } "` )
82
82
return _createRoute ( record , location , redirectedFrom )
83
- } else if ( location . path ) {
83
+ } else if ( path ) {
84
84
location . params = { }
85
- const staticRecord = pathMap [ location . path ]
85
+ const staticRecord = pathMap [ path ]
86
86
if ( staticRecord ) {
87
- if ( matchRoute ( staticRecord . regex , location . path , location . params ) ) {
87
+ if ( matchRoute ( staticRecord . regex , path , location . params ) ) {
88
88
return _createRoute ( staticRecord , location , redirectedFrom )
89
89
}
90
90
}
91
91
for ( let i = 0 ; i < pathList . length ; i ++ ) {
92
- const path = pathList [ i ]
93
- const record = pathMap [ path ]
94
- if ( matchRoute ( record . regex , location . path , location . params ) ) {
92
+ const record = pathMap [ pathList [ i ] ]
93
+ if ( matchRoute ( record . regex , path , location . params ) ) {
95
94
return _createRoute ( record , location , redirectedFrom )
96
95
}
97
96
}
0 commit comments