File tree Expand file tree Collapse file tree 5 files changed +27
-19
lines changed Expand file tree Collapse file tree 5 files changed +27
-19
lines changed Original file line number Diff line number Diff line change 56
56
}
57
57
},
58
58
cardAlign () {
59
- return ` text-${ this .align } ` ;
59
+ return this . align ? ` text-${ this .align } ` : null ;
60
60
}
61
61
},
62
62
props: {
63
63
align: {
64
64
type: String ,
65
- default: ' left '
65
+ default: null
66
66
},
67
67
inverse: {
68
68
type: Boolean ,
Original file line number Diff line number Diff line change 1
1
<template >
2
- <transition name =" collapse" >
2
+ <transition @enter = " enter " @leave = " leave " name =" collapse" >
3
3
<div :class =" classObject" v-show =" show" >
4
4
<slot ></slot >
5
5
</div >
10
10
.collapse-enter-active , .collapse-leave-active {
11
11
transition : all .35s ease ;
12
12
overflow : hidden ;
13
- max-height : 100vh ;
14
13
}
15
14
16
15
.collapse-enter , .collapse-leave-to {
17
- max- height : 0 ;
16
+ height : 0 ;
18
17
}
19
18
</style >
20
19
50
49
methods: {
51
50
toggle () {
52
51
this .show = ! this .show ;
52
+ },
53
+ enter (el ) {
54
+ let height = 0 ;
55
+ Array .prototype .forEach .call (el .children , c => {
56
+ height += parseInt (getComputedStyle (c).height , 10 );
57
+ });
58
+ el .style .height = ` ${ height} px` ;
59
+ },
60
+ leave (el ) {
61
+ el .style .height = null ;
53
62
}
54
63
},
55
64
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<li class =" nav-item" @click =" onclick" >
3
- <b-link :class =" classObject" :to =" to" :href =" href" :exact =" exact" >
3
+ <b-link :is = " itemType " : class =" classObject" :to =" to" :href =" href" :exact =" exact" >
4
4
<slot ></slot >
5
5
</b-link >
6
6
</li >
12
12
export default {
13
13
components: {bLink},
14
14
computed: {
15
+ itemType () {
16
+ return (this .href || this .to ) ? ' b-link' : ' button' ;
17
+ },
15
18
classObject () {
16
19
return [
17
20
' nav-link' ,
Original file line number Diff line number Diff line change 15
15
<slot name =" tabs" ></slot >
16
16
</ul >
17
17
</div >
18
- <div :class =" ['tab-content',{'card-block': card}]" >
18
+ <div :class =" ['tab-content',{'card-block': card}]" ref = " tabsContainer " >
19
19
<slot ></slot >
20
20
<slot name =" empty" v-if =" !tabs || !tabs.length" ></slot >
21
21
</div >
144
144
/**
145
145
* Dynamically update tabs
146
146
*/
147
- _updateTabs () {
147
+ updateTabs () {
148
148
// Probe tabs
149
149
if (this .$slots .default ) {
150
150
this .tabs = this .$slots .default .filter (tab => tab .componentInstance || false )
169
169
});
170
170
}
171
171
172
- this .setTab (tabIndex, true );
173
- },
172
+ // Workaround to fix problem when currentTab is removed
173
+ if (tabIndex > this .tabs .length - 1 ) {
174
+ tabIndex = this .tabs .length - 1 ;
175
+ }
174
176
175
- /**
176
- * Wait for next tick so we can ensure DOM is updated before we inspect it
177
- */
178
- updateTabs () {
179
- this .$nextTick (() => {
180
- this ._updateTabs ();
181
- });
177
+ this .setTab (tabIndex || 0 , true );
182
178
}
183
179
},
184
180
mounted () {
185
181
this .updateTabs ();
186
182
187
183
// Observe Child changes so we can notify tabs change
188
- observeDom (this .$el , this .updateTabs .bind (this ), {subtree: false });
184
+ observeDom (this .$refs . tabsContainer , this .updateTabs .bind (this ), {subtree: false });
189
185
}
190
186
};
191
187
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " bootstrap-vue" ,
3
- "version" : " 0.12.2 " ,
3
+ "version" : " 0.12.3 " ,
4
4
"description" : " Bootstrap 4 Components for Vue.js 2" ,
5
5
"main" : " dist/bootstrap-vue.common.js" ,
6
6
"web" : " dist/bootstrap-vue.js" ,
You can’t perform that action at this time.
0 commit comments