File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -8,27 +8,27 @@ export default {
8
8
type : [ String , Object ] ,
9
9
required : true
10
10
} ,
11
- tag : {
12
- type : String ,
13
- default : 'a'
14
- } ,
11
+ tag : String ,
12
+ exact : Boolean ,
15
13
append : Boolean ,
16
14
replace : Boolean ,
17
15
activeClass : String
18
16
} ,
19
17
render ( h ) {
20
18
const router = this . $router
21
- const current = router . history . current
19
+ const current = this . $route
22
20
const to = normalizeLocation ( this . to , current , this . append )
23
21
const resolved = router . match ( to )
24
22
const fullPath = resolved . fullPath
25
23
const base = router . history . base
26
24
const href = base ? cleanPath ( base + fullPath ) : fullPath
27
25
const classes = { }
28
26
const activeClass = this . activeClass || router . _options . linkActiveClass || 'router-link-active'
29
- classes [ activeClass ] = isSameLocation ( resolved , this . $route )
27
+ classes [ activeClass ] = this . exact
28
+ ? current . path === resolved . path
29
+ : current . path . indexOf ( resolved . path ) === 0
30
30
31
- return h ( this . tag , {
31
+ return h ( this . tag || 'a' , {
32
32
attrs : { href } ,
33
33
class : classes ,
34
34
on : {
You can’t perform that action at this time.
0 commit comments