File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,11 @@ export default function (Vue) {
79
79
}
80
80
path = this . path = router . _stringifyPath ( path )
81
81
this . activeRE = path && ! this . exact
82
- ? new RegExp ( '^' + path . replace ( / \/ $ / , '' ) . replace ( regexEscapeRE , '\\$&' ) + '(\\/|$)' )
82
+ ? new RegExp (
83
+ '^' +
84
+ path . replace ( / \/ $ / , '' ) . replace ( regexEscapeRE , '\\$&' ) +
85
+ '(\\/|$)'
86
+ )
83
87
: null
84
88
this . updateClasses ( this . vm . $route . path )
85
89
let isAbsolute = path . charAt ( 0 ) === '/'
@@ -105,6 +109,8 @@ export default function (Vue) {
105
109
if ( this . prevActiveClass !== activeClass ) {
106
110
_ . removeClass ( el , this . prevActiveClass )
107
111
}
112
+ // remove query string before matching
113
+ path = path . replace ( / \? .* $ / , '' )
108
114
// add new class
109
115
if ( this . exact ) {
110
116
if (
Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ describe('Core', function () {
338
338
expect ( linkA . className ) . toBe ( '' )
339
339
expect ( linkB . className ) . toBe ( '' )
340
340
expect ( linkC . className ) . toBe ( 'active' )
341
- router . go ( '/a' )
341
+ router . go ( '/a?a=123 ' )
342
342
nextTick ( function ( ) {
343
343
expect ( linkA . className ) . toBe ( 'active' )
344
344
expect ( linkB . className ) . toBe ( '' )
You can’t perform that action at this time.
0 commit comments