File tree Expand file tree Collapse file tree 2 files changed +48
-46
lines changed Expand file tree Collapse file tree 2 files changed +48
-46
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<button :class =" classObject"
3
- @click.stop.prevent = " click "
3
+ @click = " onclick "
4
4
:href =" href || to"
5
5
:is =" componentType"
6
6
:to =" to || href"
7
7
:exact =" exact"
8
+ :target =" target"
8
9
>
9
10
<slot ></slot >
10
11
</button >
63
64
},
64
65
variant: {
65
66
type: String ,
66
- default: ' secondary '
67
+ default: ' primary '
67
68
},
68
69
to: {
69
70
type: [String , Object ],
70
- default: ' '
71
71
},
72
72
href: {
73
73
type: String
74
74
},
75
75
exact: {
76
76
type: Boolean ,
77
77
default: false
78
+ },
79
+ target: {
80
+ type: String ,
78
81
}
79
82
},
80
83
methods: {
81
- click () {
84
+ onclick () {
82
85
this .$emit (' click' , this .to );
83
86
if (this .$router && this .to ) {
84
87
this .$router .push (this .to );
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<li class =" nav-item" >
3
3
<component
4
- class =" nav-item"
5
4
:class =" classObject"
6
- @click.stop.prevent =" onclick"
7
- :href =" to"
5
+ @click =" onclick"
6
+ :href =" href || to"
8
7
:is =" componentType"
9
8
active-class =" active"
10
9
:to =" to"
11
10
:exact =" exact"
11
+ :target =" target"
12
12
>
13
13
<slot ></slot >
14
14
</component >
17
17
18
18
<script >
19
19
20
- export default {
21
- computed: {
22
- classObject () {
23
- return [
24
- ' nav-link' ,
25
- this .active ? ' active' : ' ' ,
26
- this .disabled ? ' disabled' : ' '
27
- ];
28
- },
29
- componentType () {
30
- return this .to ? ' router-link' : ' a' ;
31
- }
32
- },
33
- props: {
34
- active: {
35
- type: Boolean ,
36
- default: false
37
- },
38
- disabled: {
39
- type: Boolean ,
40
- default: false
20
+ export default {
21
+ computed: {
22
+ classObject () {
23
+ return [
24
+ ' nav-link' ,
25
+ this .active ? ' active' : ' ' ,
26
+ this .disabled ? ' disabled' : ' '
27
+ ];
28
+ },
29
+ componentType () {
30
+ return this .to ? ' router-link' : ' a' ;
31
+ }
41
32
},
42
- to: {
43
- type: [String , Object ],
44
- default: ' '
33
+ props: {
34
+ active: {
35
+ type: Boolean ,
36
+ default: false
37
+ },
38
+ disabled: {
39
+ type: Boolean ,
40
+ default: false
41
+ },
42
+ to: {
43
+ type: [String , Object ],
44
+ },
45
+ href: {
46
+ type: String ,
47
+ },
48
+ exact: {
49
+ type: Boolean ,
50
+ default: false
51
+ },
52
+ target: {
53
+ type: String ,
54
+ }
45
55
},
46
- exact: {
47
- type: Boolean ,
48
- default: false
49
- }
50
- },
51
- methods: {
52
- onclick () {
53
- this .$emit (' click' , this .to );
54
-
55
- if (this .to ) {
56
- if (this .$router ) {
57
- this .$router .push (this .to );
58
- }
56
+ methods: {
57
+ onclick () {
58
+ this .$emit (' click' , this .to );
59
59
}
60
60
}
61
- }
62
- };
61
+ };
63
62
</script >
You can’t perform that action at this time.
0 commit comments