File tree 1 file changed +14
-11
lines changed
1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -38,27 +38,30 @@ export default {
38
38
? isSameRoute ( current , compareTarget )
39
39
: isIncludedRoute ( current , compareTarget )
40
40
41
- const data : any = {
42
- class : classes ,
43
- on : {
44
- click : ( e ) => {
45
- e . preventDefault ( )
46
- if ( this . replace ) {
47
- router . replace ( to )
48
- } else {
49
- router . push ( to )
50
- }
41
+ const on = {
42
+ click : ( e ) => {
43
+ e . preventDefault ( )
44
+ if ( this . replace ) {
45
+ router . replace ( to )
46
+ } else {
47
+ router . push ( to )
51
48
}
52
49
}
53
50
}
54
51
52
+ const data : any = {
53
+ class : classes
54
+ }
55
+
55
56
if ( this . tag === 'a' ) {
57
+ data . on = on
56
58
data . attrs = { href }
57
59
} else {
58
- // find the first <a> child and apply href
60
+ // find the first <a> child and apply listener and href
59
61
const a = findAnchor ( this . $slots . default )
60
62
if ( a ) {
61
63
const aData = a . data || ( a . data = { } )
64
+ aData . on = on
62
65
const aAttrs = aData . attrs || ( aData . attrs = { } )
63
66
aAttrs . href = href
64
67
}
You can’t perform that action at this time.
0 commit comments