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) {
7979 }
8080 path = this . path = router . _stringifyPath ( path )
8181 this . activeRE = path && ! this . exact
82- ? new RegExp ( '^' + path . replace ( / \/ $ / , '' ) . replace ( regexEscapeRE , '\\$&' ) + '(\\/|$)' )
82+ ? new RegExp (
83+ '^' +
84+ path . replace ( / \/ $ / , '' ) . replace ( regexEscapeRE , '\\$&' ) +
85+ '(\\/|$)'
86+ )
8387 : null
8488 this . updateClasses ( this . vm . $route . path )
8589 let isAbsolute = path . charAt ( 0 ) === '/'
@@ -105,6 +109,8 @@ export default function (Vue) {
105109 if ( this . prevActiveClass !== activeClass ) {
106110 _ . removeClass ( el , this . prevActiveClass )
107111 }
112+ // remove query string before matching
113+ path = path . replace ( / \? .* $ / , '' )
108114 // add new class
109115 if ( this . exact ) {
110116 if (
Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ describe('Core', function () {
338338 expect ( linkA . className ) . toBe ( '' )
339339 expect ( linkB . className ) . toBe ( '' )
340340 expect ( linkC . className ) . toBe ( 'active' )
341- router . go ( '/a' )
341+ router . go ( '/a?a=123 ' )
342342 nextTick ( function ( ) {
343343 expect ( linkA . className ) . toBe ( 'active' )
344344 expect ( linkB . className ) . toBe ( '' )
You can’t perform that action at this time.
0 commit comments