Skip to content

Commit 7ae4d90

Browse files
posvayyx990803
authored andcommitted
Fix active class priority (#1324)
Fix #1323
1 parent ae5c590 commit 7ae4d90

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/components/link.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ export default {
2121
exact: Boolean,
2222
append: Boolean,
2323
replace: Boolean,
24-
activeClass: {
25-
type: String,
26-
default: 'router-link-active'
27-
},
24+
activeClass: String,
2825
event: {
2926
type: eventTypes,
3027
default: 'click'
@@ -37,9 +34,13 @@ export default {
3734

3835
const classes = {}
3936
const globalActiveClass = router.options.linkActiveClass
40-
const activeClass = globalActiveClass == null
41-
? this.activeClass
42-
: globalActiveClass
37+
// Support global empty active class
38+
const activeClassFallback = globalActiveClass == null
39+
? 'router-link-active'
40+
: globalActiveClass
41+
const activeClass = this.activeClass == null
42+
? activeClassFallback
43+
: this.activeClass
4344
const compareTarget = location.path
4445
? createRoute(null, location, null, router)
4546
: route

0 commit comments

Comments
 (0)