File tree 5 files changed +68
-24
lines changed
5 files changed +68
-24
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
- <button :class =" classObject" @click.stop.prevent =" click" >
2
+ <button :class =" classObject"
3
+
4
+ @click.stop.prevent =" click"
5
+
6
+ :is =" componentType"
7
+ active-class =" active"
8
+ :to =" to"
9
+ :exact =" exact"
10
+ >
3
11
<slot ></slot >
4
12
</button >
5
13
</template >
18
26
this .inactive ? ' btn-inactive' : ' '
19
27
];
20
28
},
29
+ componentType (){
30
+ return this .to ? ' router-link' : ' a' ;
31
+ },
21
32
btnBlock () {
22
33
return this .block ? ` btn-block` : ' ' ;
23
34
},
60
71
type: String ,
61
72
default: ' secondary'
62
73
},
74
+ to: {
75
+ type: String ,
76
+ default: ' ' ,
77
+ },
78
+ exact: {
79
+ type: Boolean ,
80
+ default: false ,
81
+ },
63
82
},
64
83
methods: {
65
84
click : function () {
66
85
this .$emit (' click' , this .link );
86
+ if (this .$router && this .to && this .to .length ) {
87
+ this .$router .push (this .to );
88
+ }
67
89
},
68
90
},
69
91
}
Original file line number Diff line number Diff line change 16
16
return this .state ? ` has-${ this .state } ` : ' ' ;
17
17
},
18
18
labelLayout () {
19
- return this .layout == ' horizontal' ? ' col-xs-2' : ' col-xs-12' ;
19
+ return this .horizontal ? ' col-xs-2' : ' col-xs-12' ;
20
20
},
21
21
inputLayout () {
22
- return this .layout == ' horizontal' ? ' col-xs-10' : ' col-xs-12' ;
22
+ return this .horizontal ? ' col-xs-10' : ' col-xs-12' ;
23
23
}
24
24
},
25
25
props: {
31
31
type: String ,
32
32
default: null
33
33
},
34
- layout : {
35
- type: String ,
36
- default: ' horizontal '
34
+ horizontal : {
35
+ type: Boolean ,
36
+ default: false
37
37
},
38
38
label: {
39
39
type: String ,
Original file line number Diff line number Diff line change 1
1
<template >
2
- <b-form-fieldset :state =" state" :layout = " layout " :label =" label" :description =" description" :feedback =" feedback"
2
+ <b-form-fieldset :state =" state" :horizontal = " horizontal " :label =" label" :description =" description" :feedback =" feedback"
3
3
:id =" id" >
4
4
5
5
<select :class =" ['custom-select',inputSize]"
68
68
},
69
69
70
70
// FIELD SET
71
- layout : {
72
- type: String ,
73
- default: null
71
+ horizontal : {
72
+ type: Boolean ,
73
+ default: true
74
74
},
75
75
state: {
76
76
type: String ,
Original file line number Diff line number Diff line change 1
1
<template >
2
- <a class =" nav-item"
3
- href =" #"
4
- @click.stop.prevent =" onclick"
5
- :class =" classObject" >
2
+ <component
3
+ class =" nav-item"
4
+ :class =" classObject"
5
+
6
+ @click.stop.prevent =" onclick"
7
+
8
+ :is =" componentType"
9
+ active-class =" active"
10
+ :to =" to"
11
+ :exact =" exact"
12
+ >
6
13
<slot ></slot >
7
- </a >
14
+ </component >
8
15
</template >
9
16
10
17
<script >
18
+
11
19
export default {
12
20
computed: {
13
21
classObject (){
14
- return [' nav-link' , this .active ? ' active' : ' ' , this .disabled ? ' disabled' : ' ' ];
15
- }
22
+ return [
23
+ ' nav-link' ,
24
+ this .active ? ' active' : ' ' ,
25
+ this .disabled ? ' disabled' : ' '
26
+ ];
27
+ },
28
+ componentType (){
29
+ return this .to ? ' router-link' : ' a' ;
30
+ },
16
31
},
17
32
props: {
18
- link: {
19
- type: String ,
20
- default: ' '
21
- },
22
33
active: {
23
34
type: Boolean ,
24
35
default: false
25
36
},
26
37
disabled: {
27
38
type: Boolean ,
28
39
default: false
29
- }
40
+ },
41
+ to: {
42
+ type: String ,
43
+ default: ' ' ,
44
+ },
45
+ exact: {
46
+ type: Boolean ,
47
+ default: false ,
48
+ },
30
49
},
31
50
methods: {
32
51
onclick : function () {
33
- this .$emit (' click' , this .link );
52
+ this .$emit (' click' , this .to );
53
+ if (this .$router && this .to && this .to .length ) {
54
+ this .$router .push (this .to );
55
+ }
34
56
}
35
57
}
36
58
}
Original file line number Diff line number Diff line change 26
26
},
27
27
fill: {
28
28
type: Boolean ,
29
- default: true
29
+ default: false
30
30
},
31
31
tabs: {
32
32
type: Boolean ,
You can’t perform that action at this time.
0 commit comments